Skip to content

Commit 09ac3f9

Browse files
committed
feat(headlines-search): add default sorting by name in search results
- Add ascending sort by 'name' for topics and sources in headlines search - Implement consistent sorting across paginated search results
1 parent cbedf24 commit 09ac3f9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/headlines-search/bloc/headlines_search_bloc.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ class HeadlinesSearchBloc
141141
limit: _limit,
142142
cursor: successState.cursor,
143143
),
144+
sort: [const SortOption('name', SortOrder.asc)],
144145
);
145146
emit(
146147
successState.copyWith(
@@ -158,6 +159,7 @@ class HeadlinesSearchBloc
158159
limit: _limit,
159160
cursor: successState.cursor,
160161
),
162+
sort: [const SortOption('name', SortOrder.asc)],
161163
);
162164
emit(
163165
successState.copyWith(
@@ -228,12 +230,14 @@ class HeadlinesSearchBloc
228230
rawResponse = await _topicRepository.readAll(
229231
filter: {'q': searchTerm},
230232
pagination: const PaginationOptions(limit: _limit),
233+
sort: [const SortOption('name', SortOrder.asc)],
231234
);
232235
processedItems = rawResponse.items.cast<FeedItem>();
233236
case ContentType.source:
234237
rawResponse = await _sourceRepository.readAll(
235238
filter: {'q': searchTerm},
236239
pagination: const PaginationOptions(limit: _limit),
240+
sort: [const SortOption('name', SortOrder.asc)],
237241
);
238242
processedItems = rawResponse.items.cast<FeedItem>();
239243
default:

0 commit comments

Comments
 (0)