Skip to content

feat: debounce search input#173

Merged
gamosoft merged 2 commits intogamosoft:mainfrom
ricky-davis:feat/better-search
Feb 23, 2026
Merged

feat: debounce search input#173
gamosoft merged 2 commits intogamosoft:mainfrom
ricky-davis:feat/better-search

Conversation

@ricky-davis
Copy link
Copy Markdown
Contributor

While working with large vaults, /api/search can 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

  • Frontend search debounce
    • Adds SEARCH_DEBOUNCE_DELAY (1000ms) to config
    • Introduces debouncedSearchNotes() which delays search execution while typing
    • Updates the search input handler to call debouncedSearchNotes() instead of searchNotes() directly
  • UX state
    • Adds isSearching state to control display while a search request is running
    • Shows a “Searching for …” message instead of immediately showing “no results” during the debounce/in-flight period
  • i18n
    • Adds search.searching translation key across supported locales

Motivation / context

Inspired by performance observations from PR: #172 — debouncing avoids hammering the backend and makes search feel smoother on large vaults.

@gamosoft
Copy link
Copy Markdown
Owner

Thanks a lot mate, you're on fire @ricky-davis! 😎 This is also a very good addition to the app.
I think 1 second can be way too much "waiting" for a response though, how about 500-750ms?
I don't think (for now) this should be a configurable setting, so we can compromise to a smaller value?

@gamosoft
Copy link
Copy Markdown
Owner

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). 😉

@gamosoft gamosoft merged commit 3495c0d into gamosoft:main Feb 23, 2026
@ricky-davis
Copy link
Copy Markdown
Contributor Author

ricky-davis commented Feb 23, 2026

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 😅

@gamosoft
Copy link
Copy Markdown
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants