Skip 400ms search throttle for in-memory autocomplete filtering#7434
Open
GeorgiZhelev wants to merge 1 commit into
Open
Skip 400ms search throttle for in-memory autocomplete filtering#7434GeorgiZhelev wants to merge 1 commit into
GeorgiZhelev wants to merge 1 commit into
Conversation
5 tasks
Contributor
|
Thanks for your contribution! Could you please rebase? The failing check should pass after that |
090f5c0 to
67745ee
Compare
Contributor
Author
|
Hey, done! |
gonzaloriestra
approved these changes
May 12, 2026
Contributor
gonzaloriestra
left a comment
There was a problem hiding this comment.
Nice work, thanks!! It really feels much faster ⚡
| '@shopify/cli-kit': patch | ||
| --- | ||
|
|
||
| Make the autocomplete prompt feel instant when filtering against in-memory choices. The 400ms throttle on the search callback was designed for remote/paginated backends, but it also gated the default in-memory filter used by callers that don't supply their own `search` (e.g. the theme selector), producing a noticeable lag while typing. The prompt now exposes a `searchDebounceMs` prop, and `renderAutocompletePrompt` sets it to `0` when it injects its own synchronous filter. Custom remote-search consumers keep the existing 400ms throttle unless they opt out. |
Contributor
There was a problem hiding this comment.
Would you mind simplifying here a bit?
Suggested change
| Make the autocomplete prompt feel instant when filtering against in-memory choices. The 400ms throttle on the search callback was designed for remote/paginated backends, but it also gated the default in-memory filter used by callers that don't supply their own `search` (e.g. the theme selector), producing a noticeable lag while typing. The prompt now exposes a `searchDebounceMs` prop, and `renderAutocompletePrompt` sets it to `0` when it injects its own synchronous filter. Custom remote-search consumers keep the existing 400ms throttle unless they opt out. | |
| Make the autocomplete prompt feel instant when filtering against in-memory choices. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WHY are these changes introduced?
Filtering inside
renderAutocompletePrompt(e.g. the theme selector that appears forshopify theme push) feels noticeably laggy: there's a ~400ms gap between typing and seeing matching results update.The cause is the throttle on the search callback in
AutocompletePrompt(packages/cli-kit/src/private/node/ui/components/AutocompletePrompt.tsx). The 400ms window makes sense for callers that supply a remote/paginatedsearch(we don't want to hammer an API on every keystroke), but it also gates the default in-memory filter thatrenderAutocompletePromptinjects when the caller doesn't pass one — and that filter is fully synchronous (Promise.resolve(choices.filter(...))), so there's no I/O to throttle.WHAT is this pull request doing?
searchDebounceMsprop toAutocompletePrompt, default400(backward-compatible).renderAutocompletePromptsetssearchDebounceMs: 0only when it's injecting its own default in-memory filter; if the caller supplied their ownsearch, the default 400ms throttle still applies.searchDebounceMs={0}invokes the search callback on every keystroke (vs. coalescing to leading + trailing edges).Net effect: prompts that filter against in-memory choices feel instant; remote/paginated consumers see no behavior change unless they opt in.
How to test your changes?
pnpm nx build clinode packages/cli/bin/dev.js theme pushUnit tests:
Post-release steps
None.
Checklist
patchchangeset for@shopify/cli-kit.