Skip to content

Commit 9d59e15

Browse files
committed
refactor(content_management): simplify BlocConsumer logic
- Remove unnecessary conditions in listenWhen - Adjust state update logic for initial status only
1 parent deabb6c commit 9d59e15

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

lib/content_management/view/edit_source_page.dart

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,7 @@ class _EditSourceViewState extends State<_EditSourceView> {
9494
],
9595
),
9696
body: BlocConsumer<EditSourceBloc, EditSourceState>(
97-
listenWhen: (previous, current) =>
98-
previous.status != current.status ||
99-
previous.name != current.name ||
100-
previous.description != current.description ||
101-
previous.url != current.url,
97+
listenWhen: (previous, current) => previous.status != current.status,
10298
listener: (context, state) {
10399
if (state.status == EditSourceStatus.success &&
104100
state.updatedSource != null &&
@@ -121,8 +117,7 @@ class _EditSourceViewState extends State<_EditSourceView> {
121117
);
122118
}
123119
// Update text controllers when data is loaded or changed
124-
if (state.status == EditSourceStatus.initial ||
125-
state.status == EditSourceStatus.success) {
120+
if (state.status == EditSourceStatus.initial) {
126121
_nameController.text = state.name;
127122
_descriptionController.text = state.description;
128123
_urlController.text = state.url;

0 commit comments

Comments
 (0)