Skip to content

Commit

Permalink
TW-1994: Fix load more for chat search (#1997)
Browse files Browse the repository at this point in the history
  • Loading branch information
nqhhdev authored Aug 20, 2024
1 parent 192228e commit 7ed3c82
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion lib/pages/search/server_search_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,25 @@ class ServerSearchController with SearchDebouncerMixin {
if (success is ServerSearchChatSuccess) {
updateNextBatch(success.nextBatch);
if (success.results?.isEmpty == true) {
searchResultsNotifier.value = PresentationServerSideEmptySearch();
if (isLoadingMoreNotifier.value) {
searchResultsNotifier.value = PresentationServerSideSearch(
searchResults: [
if (searchResultsNotifier.value
is PresentationServerSideSearch)
...(searchResultsNotifier.value
as PresentationServerSideSearch)
.searchResults,
...success.results ?? <Result>[],
]
.where(
(result) =>
result.isDisplayableResult(context: currentContext),
)
.toList(),
);
} else {
searchResultsNotifier.value = PresentationServerSideEmptySearch();
}
} else {
searchResultsNotifier.value = PresentationServerSideSearch(
searchResults: [
Expand Down

0 comments on commit 7ed3c82

Please sign in to comment.