Enable fuzzy search behind a feature flag. (#1490)

This commit is contained in:
Doug
2023-08-14 17:41:41 +01:00
committed by GitHub
parent b58f76b170
commit b2928a0dc6
11 changed files with 62 additions and 17 deletions
@@ -80,9 +80,13 @@ struct HomeScreen: View {
updateVisibleRange()
}
.onChange(of: context.searchQuery) { searchQuery in
guard searchQuery.isEmpty else { return }
// Dispatch allows the view to update after changing the query
DispatchQueue.main.async { updateVisibleRange() }
if context.viewState.fuzzySearchEnabled {
context.send(viewAction: .updatedSearchQuery)
} else {
guard searchQuery.isEmpty else { return }
// Dispatch allows the view to update after changing the query
DispatchQueue.main.async { updateVisibleRange() }
}
}
.onReceive(scrollViewAdapter.scrollDirection) { direction in
withAnimation(.elementDefault) { lastScrollDirection = direction }