Repository navigation
Fix dropped keystrokes and lag in plugin search - #4102
Merged
SawyerHood merged 1 commit intoSep 22, 2026
Merged
Conversation
The plugin search input was controlled directly by the URL query param. React Router 7 applies navigations in startTransition, so React restored the input to the stale value between keystrokes (typing "terminal notes" produced "t ntes"), and every keystroke re-rendered the whole browse page, including an unpaginated grid of the full catalog. - PluginCollectionToolbar keeps a local draft and writes the URL 200 ms after typing stops (clearing writes immediately). Incoming URL values that match in-flight writes are ignored, so a lagging navigation cannot overwrite newer typing. - Browse and author tabs drop their second 300 ms debounce. - PluginCatalogGrid renders a page at a time with infinite scroll. - Browse shelves stay mounted (hidden) during a search, so clearing the query no longer rebuilds ~100 shelf cards. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
SawyerHood
deleted the
bb/fix-plugin-search-input-functionality-thr_ejj4wsiu7n
branch
September 22, 2026 23:47
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.
Human comments
What was wrong
The plugin search input was controlled directly by the URL
queryparam (since #2941). React Router 7 applies every navigation insidestartTransition, so after each keystroke React restored the controlled input to the stale URL value before the navigation landed. Typing "terminal notes" quickly producedt ntes/tal otes. Each keystroke also re-rendered the whole browse route. Since #3644, the first keystroke swapped the shelves for an unpaginated grid of the full catalog (~270 cards), and clearing the query rebuilt ~100 shelf cards in one blocking task.What changed
PluginBrowseControls.tsx:PluginCollectionToolbarkeeps a local search draft. It writes the URL 200 ms after typing stops; clearing writes immediately. Incoming URL values are adopted only when they are not one of the toolbar's own in-flight writes, so a lagging navigation cannot overwrite newer typing. Back/forward still updates the input. This applies to the Browse, Installed, and Author views.BrowsePluginsTab.tsx,PluginAuthorPage.tsx: drop the second 300 msuseDebouncedValue. The URL value is already debounced.PluginCatalogCard.tsx:PluginCatalogGridrendersRESOURCE_GRID_PAGE_SIZEcards at a time withResourceInfiniteScrollSentinel, like the Installed list.BrowsePluginsTab.tsx: shelves are built from the unfiltered catalog and stay mounted with thehiddenattribute while a search is active. Clearing the query no longer remounts them.<Activity>was measured too; it re-runs every card's mount effects (Radix Tooltip/Avatar) on reveal and was about 2× slower thanhidden.Known edge: pressing back within 200 ms of typing can let the pending write re-apply the typed query.
How you verified
New tests, each shown to fail on the code before its fix and pass after:
BrowsePluginsTab.test.tsx"keeps every keystroke while the URL query catches up": dispatches native input events outsideact, as real keystrokes arrive. The old code reverts the first keystroke to''.BrowsePluginsTab.test.tsx"renders search results a page at a time": the old code rendered 30 cards instead of 12.BrowsePluginsTab.test.tsx"keeps the shelves mounted while a search is active": the previous version rebuilt the shelves element.PluginBrowseControls.test.tsx"keeps typed text while the URL query lags behind": an earlier draft of this fix reverted toMemory.Existing tests that asserted the URL synchronously after
fireEvent.changenow wait for the debounced write.vitest run src/components/plugin src/views/ToolsView.plugin-detail.test.tsx: 54 files, 568 tests pass.turbo run typecheck lint --filter=@bb/app: passes.Live dev app (headless Chromium, Event Timing + Long Tasks APIs). Typing "terminal notes" at 60 ms/key:
t ntes/tal otesterminal notesBackspacing to empty, alternating versions in the same session: worst long task 319–389 ms → 63–64 ms. Search results, infinite scroll (24 → 96 cards), and clearing back to the shelves all work.
🤖 Generated with Claude Code