From 6cdcb538c41174ea40a00296418240d844b6777f Mon Sep 17 00:00:00 2001 From: Sjmarf <78750526+Sjmarf@users.noreply.github.com> Date: Fri, 6 Oct 2023 21:31:11 +0100 Subject: [PATCH] Update SearchResultsView.swift --- Mlem/Views/Tabs/Search/SearchResultsView.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Mlem/Views/Tabs/Search/SearchResultsView.swift b/Mlem/Views/Tabs/Search/SearchResultsView.swift index a5a24e989..c9a7b83a4 100644 --- a/Mlem/Views/Tabs/Search/SearchResultsView.swift +++ b/Mlem/Views/Tabs/Search/SearchResultsView.swift @@ -22,7 +22,10 @@ struct SearchResultsView: View { .padding(.top, 8) SearchResultListView(showTypeLabel: searchModel.searchTab == .topResults) } - .onChange(of: searchModel.searchText) { newValue in + .onReceive( + searchModel.$searchText + .debounce(for: .seconds(0.2), scheduler: DispatchQueue.main) + ) { newValue in if searchModel.previousSearchText != newValue { if !newValue.isEmpty { contentTracker.refresh(using: searchModel.performSearch)