Skip to content

Commit 5e328e5

Browse files
committed
refactor(content_management): update the BlocListener in create_source_page.dart. Instead of triggering a full data reload, it will now dispatch the new SourceAdded event. This event passes the newly created source object directly to the ContentManagementBloc, which will add it to the list locally for an immediate and efficient UI update.
1 parent 63d0304 commit 5e328e5

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/content_management/view/create_source_page.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,16 @@ class _CreateSourceViewState extends State<_CreateSourceView> {
7777
listenWhen: (previous, current) => previous.status != current.status,
7878
listener: (context, state) {
7979
if (state.status == CreateSourceStatus.success &&
80+
state.createdSource != null &&
8081
ModalRoute.of(context)!.isCurrent) {
8182
ScaffoldMessenger.of(context)
8283
..hideCurrentSnackBar()
8384
..showSnackBar(
8485
SnackBar(content: Text(l10n.sourceCreatedSuccessfully)),
8586
);
86-
context.read<ContentManagementBloc>().add(
87-
const LoadSourcesRequested(
88-
limit: kDefaultRowsPerPage,
89-
),
90-
);
87+
context
88+
.read<ContentManagementBloc>()
89+
.add(SourceAdded(state.createdSource!));
9190
context.pop();
9291
}
9392
if (state.status == CreateSourceStatus.failure) {

0 commit comments

Comments
 (0)