Skip 400ms search throttle for in-memory autocomplete filtering#7434
Open
GeorgiZhelev wants to merge 1 commit intoShopify:mainfrom
Open
Skip 400ms search throttle for in-memory autocomplete filtering#7434GeorgiZhelev wants to merge 1 commit intoShopify:mainfrom
GeorgiZhelev wants to merge 1 commit intoShopify:mainfrom
Conversation
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.