Skip to content

Commit cb7b8ad

Browse files
committed
refactor(content_management): update the BlocListener in edit_source_page.dart. When an edit is successful, it will dispatch the SourceUpdated event, passing the updated source object directly to the ContentManagementBloc. This completes our UI refactoring, ensuring all create and edit operations result in an efficient local list update rather than a full reload.
1 parent 5e328e5 commit cb7b8ad

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/content_management/view/edit_source_page.dart

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,16 @@ class _EditSourceViewState extends State<_EditSourceView> {
105105
previous.initialSource != current.initialSource,
106106
listener: (context, state) {
107107
if (state.status == EditSourceStatus.success &&
108-
state.initialSource != null &&
108+
state.updatedSource != null &&
109109
ModalRoute.of(context)!.isCurrent) {
110110
ScaffoldMessenger.of(context)
111111
..hideCurrentSnackBar()
112112
..showSnackBar(
113113
SnackBar(content: Text(l10n.sourceUpdatedSuccessfully)),
114114
);
115-
context.read<ContentManagementBloc>().add(
116-
const LoadSourcesRequested(
117-
limit: kDefaultRowsPerPage,
118-
),
119-
);
115+
context
116+
.read<ContentManagementBloc>()
117+
.add(SourceUpdated(state.updatedSource!));
120118
context.pop();
121119
}
122120
if (state.status == EditSourceStatus.failure) {

0 commit comments

Comments
 (0)