Skip to content

Commit 63d0304

Browse files
committed
refactor(content_management): update the BlocListener in edit_headline_page.dart. When an edit is successful, it will now dispatch the new HeadlineUpdated event, passing the updated headline object directly to the ContentManagementBloc. This allows the main list to update the specific item locally, which is much more efficient than reloading the entire list.
1 parent a9801e8 commit 63d0304

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/content_management/view/edit_headline_page.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class _EditHeadlineViewState extends State<_EditHeadlineView> {
106106
previous.initialHeadline != current.initialHeadline,
107107
listener: (context, state) {
108108
if (state.status == EditHeadlineStatus.success &&
109-
state.initialHeadline != null &&
109+
state.updatedHeadline != null &&
110110
ModalRoute.of(context)!.isCurrent) {
111111
ScaffoldMessenger.of(context)
112112
..hideCurrentSnackBar()
@@ -116,10 +116,8 @@ class _EditHeadlineViewState extends State<_EditHeadlineView> {
116116
),
117117
);
118118
context.read<ContentManagementBloc>().add(
119-
const LoadHeadlinesRequested(
120-
limit: kDefaultRowsPerPage,
121-
),
122-
);
119+
HeadlineUpdated(state.updatedHeadline!),
120+
);
123121
context.pop();
124122
}
125123
if (state.status == EditHeadlineStatus.failure) {

0 commit comments

Comments
 (0)