Skip to content

Commit

Permalink
Avoid search rate limit (#704)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjmarf authored Oct 7, 2023
1 parent fbc2694 commit c04d3c2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Mlem/Views/Tabs/Search/SearchResultsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c04d3c2

Please sign in to comment.