Skip to content

Commit deabb6c

Browse files
committed
refactor(content_management): optimize EditTopicBloc state comparison
- Simplify listenWhen condition by removing unnecessary checks - Remove redundant status check for data loading
1 parent fa68e57 commit deabb6c

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

lib/content_management/view/edit_topic_page.dart

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,7 @@ class _EditTopicViewState extends State<_EditTopicView> {
9595
],
9696
),
9797
body: BlocConsumer<EditTopicBloc, EditTopicState>(
98-
listenWhen: (previous, current) =>
99-
previous.status != current.status ||
100-
previous.name != current.name ||
101-
previous.description != current.description ||
102-
previous.iconUrl != current.iconUrl,
98+
listenWhen: (previous, current) => previous.status != current.status,
10399
listener: (context, state) {
104100
if (state.status == EditTopicStatus.success &&
105101
state.updatedTopic != null &&
@@ -125,8 +121,7 @@ class _EditTopicViewState extends State<_EditTopicView> {
125121
);
126122
}
127123
// Update text controllers when data is loaded or changed
128-
if (state.status == EditTopicStatus.initial ||
129-
state.status == EditTopicStatus.success) {
124+
if (state.status == EditTopicStatus.initial) {
130125
_nameController.text = state.name;
131126
_descriptionController.text = state.description;
132127
_iconUrlController.text = state.iconUrl;

0 commit comments

Comments
 (0)