add debounce to searchBar

This commit is contained in:
DawudOsman 2025-04-17 13:36:48 +01:00
parent 6640a8a4b7
commit 78865f9330

View file

@ -325,7 +325,7 @@ struct SearchBar: View {
.onChange(of: text){newValue in
debounceTimer?.invalidate()
// Start a new timer to wait before performing the action
debounceTimer = Timer.scheduledTimer(withTimeInterval: 0.25, repeats: false) { _ in
debounceTimer = Timer.scheduledTimer(withTimeInterval: 0.5, repeats: false) { _ in
// Perform the action after the delay (debouncing)
onSearchButtonClicked()
}