Skip to content

Fix crud data fetch sorting #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/content_management/bloc/content_management_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class ContentManagementBloc
final previousHeadlines = isPaginating ? state.headlines : <Headline>[];

final paginatedHeadlines = await _headlinesRepository.readAll(
sort: [const SortOption('updatedAt', SortOrder.desc)],
pagination: PaginationOptions(
cursor: event.startAfterId,
limit: event.limit,
Expand Down Expand Up @@ -140,6 +141,7 @@ class ContentManagementBloc
final previousTopics = isPaginating ? state.topics : <Topic>[];

final paginatedTopics = await _topicsRepository.readAll(
sort: [const SortOption('updatedAt', SortOrder.desc)],
pagination: PaginationOptions(
cursor: event.startAfterId,
limit: event.limit,
Expand Down Expand Up @@ -219,6 +221,7 @@ class ContentManagementBloc
final previousSources = isPaginating ? state.sources : <Source>[];

final paginatedSources = await _sourcesRepository.readAll(
sort: [const SortOption('updatedAt', SortOrder.desc)],
pagination: PaginationOptions(
cursor: event.startAfterId,
limit: event.limit,
Expand Down
2 changes: 1 addition & 1 deletion lib/content_management/view/edit_headline_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class _EditHeadlineViewState extends State<_EditHeadlineView> {
SnackBar(content: Text(l10n.headlineUpdatedSuccessfully)),
);
context.read<ContentManagementBloc>().add(
HeadlineUpdated(state.updatedHeadline!),
const LoadHeadlinesRequested(limit: kDefaultRowsPerPage),
);
context.pop();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/content_management/view/edit_source_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class _EditSourceViewState extends State<_EditSourceView> {
SnackBar(content: Text(l10n.sourceUpdatedSuccessfully)),
);
context.read<ContentManagementBloc>().add(
SourceUpdated(state.updatedSource!),
const LoadSourcesRequested(limit: kDefaultRowsPerPage),
);
context.pop();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/content_management/view/edit_topic_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class _EditTopicViewState extends State<_EditTopicView> {
SnackBar(content: Text(l10n.topicUpdatedSuccessfully)),
);
context.read<ContentManagementBloc>().add(
TopicUpdated(state.updatedTopic!),
const LoadTopicsRequested(limit: kDefaultRowsPerPage),
);
context.pop();
}
Expand Down
Loading