SearchResults: Fix how running searches can be cancelled

Search results are wiped when the user switches to a new tab in the
app, but this should only be executed when the search is running.

Fortunately, just tracking the ProgressView's status should fix this
problem.

Signed-off-by: kingbri <bdashore3@gmail.com>
This commit is contained in:
kingbri 2022-08-10 21:40:00 -04:00
parent 95ea2be722
commit 33c9a4ead2

View file

@ -61,7 +61,7 @@ struct SearchResultsView: View {
}
.onChange(of: navModel.selectedTab) { tab in
// Cancel the search if tab is switched
if tab != .search, isSearching {
if tab != .search, isSearching, navModel.showSearchProgress {
scrapingModel.runningSearchTask?.cancel()
dismissSearch()
}