Start a foreground search backfill request when entering the message search tab

This commit is contained in:
Stefan Ceriu
2026-09-28 18:54:24 +03:00
parent 790bf0a44e
commit d08b0e0090
2 changed files with 17 additions and 1 deletions
@@ -102,8 +102,12 @@ class SearchScreenViewModel: SearchScreenViewModelType, SearchScreenViewModelPro
// Re-run the search when switching tabs so the newly active tab reflects the current query.
let searchModeStream = context.observe(\.viewState.bindings.searchMode).removeDuplicates()
searchModeObservationTask = Task { [weak self] in
for await _ in searchModeStream {
for await searchMode in searchModeStream {
guard let self else { return }
// Opening the messages tab signals the user actually wants history to be searchable.
if searchMode == .messages {
clientProxy.startSearchBackfill(strategy: .foreground)
}
updateFilter(for: state.bindings.searchQuery)
}
}