From 33c9a4ead285169e49dfbbe07a34c0e144bdbf46 Mon Sep 17 00:00:00 2001 From: kingbri Date: Wed, 10 Aug 2022 21:40:00 -0400 Subject: [PATCH] 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 --- Ferrite/Views/SearchResultsView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ferrite/Views/SearchResultsView.swift b/Ferrite/Views/SearchResultsView.swift index 775d107..626c268 100644 --- a/Ferrite/Views/SearchResultsView.swift +++ b/Ferrite/Views/SearchResultsView.swift @@ -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() }