feat: debounce search input#173
Conversation
|
Thanks a lot mate, you're on fire @ricky-davis! 😎 This is also a very good addition to the app. |
|
Actually I'm going to merge this now, because I do want to fix an ugly issue with the new feature to hide the "system" folders, there is a small flash that I want to get rid of with a new release. I will merge this but will see about an appropriate debounce time (1s is just too much IMHO). 😉 |
|
Yeah all good man, it's your repo. 1s seemed right with my testing but I'm also testing on 6000 files and when the debounce hits too soon it's still choppy even with the other PR speeding it up, which I recognize is not a normal use-case 😅 |
|
6000 files, Christ! 🙃 I have set it up for 500ms for now, it's a good compromise to keep the UI "fresh" for most of us that don't have so many notes. I have already released with that annoying flash, please let me know how you feel: https://github.com/gamosoft/NoteDiscovery/releases/tag/v0.16.3 If it becomes a pain point I can always think of adding a configurable delay to it, but I don't want to clutter the settings interface too much with tons of options that most of the people won't ever use. In any case, thank you SO MUCH again for your contributions, they will also help my workflow from now on. 😎 Kind regards. |
While working with large vaults,
/api/searchcan take long enough that triggering a search on every keystroke makes the UI feel jumpy and slow. This MR debounces the sidebar search input so we only run the search after the user pauses typing, and adds a “searching…” state while the request is in-flight.Changes
SEARCH_DEBOUNCE_DELAY(1000ms) to configdebouncedSearchNotes()which delays search execution while typingdebouncedSearchNotes()instead ofsearchNotes()directlyisSearchingstate to control display while a search request is runningsearch.searchingtranslation key across supported localesMotivation / context
Inspired by performance observations from PR: #172 — debouncing avoids hammering the backend and makes search feel smoother on large vaults.