Skip to content

feat(loaders): add a debounce option to query loaders - #529

Merged
kianbazza merged 1 commit into
ui-557-add-stream-and-block-reveal-for-async-contentfrom
ui-558-add-a-debounce-option-to-query-loaders
Sep 29, 2026
Merged

kianbazza merged 1 commit into
ui-557-add-stream-and-block-reveal-for-async-contentfrom
ui-558-add-a-debounce-option-to-query-loaders

Conversation

@kianbazza

@kianbazza kianbazza commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Query loaders accept debounce (ms, default 0): createQueryLoader, createSWRQueryLoader and createVanillaQueryLoader. The engine holds the search until it stops changing, then passes it to the loader. The loader's query and enabled both come from the held search, so a search that minQueryLength disallows is never run. While a newer search waits, the loader counts as fetching. useAsyncMenuCoordinator().isAnyFetching can drive a "working" indicator, and the menu doesn't treat the search as finished.

type "a", "ab" within the debounce  -> the loader sees "", then "ab" (never "a")

Evidence

New loader-debounce.test.tsx (fake timers, 7 tests):

  • Only '' and 'ab' reach the fetcher.
  • With minQueryLength: 2, '' is never fetched while 'ab' waits.
  • Empty stays hidden during the wait and shows after.
  • isAnyFetching is true during the wait.
  • A loader that reports the new search a render late, or whose real result looks exactly like the waiting state, still settles on the right rows.
  • debounce: 0 fetches every keystroke as before.

Merge Danger

Door: two-way

Blast Radius: none by default

Default 0 keeps today's behaviour.

Closes UI-558

@vercel

vercel Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ui-canary Ready Ready Preview Sep 29, 2026 2:31pm UTC

Request Review

@kianbazza
kianbazza added this pull request to stack #526 September 28, 2026 23:52
@linear-code

linear-code Bot commented Sep 28, 2026

Copy link
Copy Markdown

UI-558

@kianbazza
kianbazza force-pushed the ui-558-add-a-debounce-option-to-query-loaders branch from 3f2fa24 to ed93571 Compare September 29, 2026 14:29
@kianbazza
kianbazza marked this pull request as ready for review September 29, 2026 14:45
@kianbazza
kianbazza merged commit 070dc1e into canary Sep 29, 2026
5 of 8 checks passed

This branch was successfully deployed

1 active deployment
Preview – ui-canary — ed935712 Deployed Sep 29, 2026 by vercel[bot]
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.

1 participant