Repository navigation
Replace plugin Browse with category shelves - #2941
Conversation
|
🚨 SLOP COP 🚨 · I am SlopCop. I am reviewing this pull request for security, code quality, performance, architecture, and user behavior. |
| const [installTarget, setInstallTarget] = | ||
| useState<PluginCatalogSearchEntry | null>(null); | ||
| const listQuery = usePluginList({ enabled: true }); | ||
| const catalogQuery = usePluginCatalogSearch(pluginId, { enabled: true }); |
There was a problem hiding this comment.
🚨 slopcop/review — A cold detail view sends an extra catalog request
The parent already requests the full catalog. This detail also requests the plugin ID and the full catalog.
The server scans all catalog entries before it applies the search. Use the full result, and request the exact result only as fallback.
| (nextPluginId: string, trigger: HTMLButtonElement) => { | ||
| focusReturnRef.current = trigger; | ||
| navigate({ | ||
| pathname: getPluginDetailRoutePath({ pluginId: nextPluginId }), |
There was a problem hiding this comment.
🚨 slopcop/review — The production route removes Browse when a detail opens
This navigation moves from the explicit collection route to the wildcard detail route. React removes this ToolsView and creates a new one.
I confirmed that the search clears after a card opens. The close action then focuses the document body instead of the card.
Use one common parent route so the same ToolsView stays active for both paths.
| onOpenPlugin={openPlugin} | ||
| /> | ||
| ); | ||
| } else if (catalogQuery.isError) { |
There was a problem hiding this comment.
🚨 slopcop/review — An exact-search error hides a valid fallback entry
The code can find the selected entry in the full catalog. This error branch runs before the code renders that entry.
A temporary exact-search failure therefore replaces valid cached detail data with an error. Render a found entry before this error branch.
| entries: readonly PluginCatalogSearchEntry[], | ||
| collection: PluginCatalogCollection, | ||
| ): PluginCatalogSearchEntry[] { | ||
| const entriesByPluginId = new Map( |
There was a problem hiding this comment.
🚨 slopcop/review — Collection lookup loses the marketplace identity
The server permits the same plugin ID in several marketplaces. This map keeps only the last entry for each plugin ID.
A collection can therefore show a plugin from the wrong marketplace. Add marketplace identity to collection data and use composite keys.
| onOpenPlugin: (pluginId: string, trigger: HTMLButtonElement) => void; | ||
| onInstallFromSource: () => void; | ||
| }) { | ||
| const [query, setQuery] = useState(""); |
There was a problem hiding this comment.
🚨 slopcop/review — Search does not use the URL
The category and sort values use URL parameters, but the search uses local state. A reload or shared link loses the search.
Read the search from a URL parameter. Update that parameter through the existing search-parameter helper.
| } | ||
|
|
||
| @container plugin-shelf (max-width: 48.999rem) { | ||
| [data-plugin-shelf-grid] > :nth-child(n + 5) { |
There was a problem hiding this comment.
🚨 slopcop/review — “See all” cannot show extra cards on narrow shelves
This rule hides each card after item four, even after React expands the shelf.
I tested a 700-pixel shelf. Expansion changed the DOM count from six to eight, but only four cards stayed visible.
The action then disappeared for that shelf. Apply this rule only when the shelf is closed.
There was a problem hiding this comment.
🚨 SLOP COP 🚨 · review
This PR replaces publisher groups with category shelves. It adds richer plugin cards, new filters, and a side panel for plugin details.
I found two high-impact problems:
- Narrow shelves hide every card after item four. The See all action expands the DOM, but the extra cards stay hidden.
- The production router removes Browse when a detail opens. Search state disappears, and the close action cannot restore card focus.
I also found four medium-impact problems:
- Collection lookup loses marketplace identity and can select the wrong plugin when marketplaces use the same plugin ID.
- Search does not use a URL parameter, although the pull request states that it does.
- An exact-search error hides a valid entry from the full catalog cache.
- A cold detail view sends an extra catalog request that repeats server catalog work.
The security review found one low privacy risk. Remote screenshot URLs contact third-party hosts when a user views plugin details.
The performance review also found eager avatar requests for cards below the viewport. Lazy avatar work or initials would reduce this cost.
The new category control duplicates much of ResourceMultiSelectMenu. The new install control also duplicates the shared resource install controls.
Please extend the shared controls with the required metadata and search behavior. This change will keep one control contract across resource screens.
I ran the full app suite at the exact head SHA. All 3,740 tests passed, with four skipped tests.
I also tested the real app with doobie. The browser test confirmed the shelf and route failures above.
The detail test uses one wildcard test route. The production app uses separate collection and detail routes, so the test misses the remount.
362d27f to
0279e96
Compare
cb2d31a to
c3ab175
Compare
c3ab175 to
abe1f46
Compare
## Human comments ## What was wrong The plugin search input was controlled directly by the URL `query` param (since #2941). React Router 7 applies every navigation inside `startTransition`, so after each keystroke React restored the controlled input to the stale URL value before the navigation landed. Typing "terminal notes" quickly produced `t 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`: `PluginCollectionToolbar` keeps 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 ms `useDebouncedValue`. The URL value is already debounced. - `PluginCatalogCard.tsx`: `PluginCatalogGrid` renders `RESOURCE_GRID_PAGE_SIZE` cards at a time with `ResourceInfiniteScrollSentinel`, like the Installed list. - `BrowsePluginsTab.tsx`: shelves are built from the unfiltered catalog and stay mounted with the `hidden` attribute 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 than `hidden`. 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 outside `act`, 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 to `Memory`. - Existing tests that asserted the URL synchronously after `fireEvent.change` now 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: | | Before | After | |---|---|---| | Resulting value | `t ntes` / `tal otes` | `terminal notes` | | Long tasks per run | 5 (max ~530 ms) | 0 | | Slowest keystroke to paint | 728–760 ms | 16–32 ms | Backspacing 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. > AGENT GENERATED 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Human comments
What was wrong
Browse grouped plugins by publisher. It did not use category and collection data from marketplace v2.
What changed
Visual QA
Catalog icon alignment
How you verified
pnpm exec turbo run typecheck --filter=@bb/app --filter=@bb/shared-ui --filter=@bb/client-corepassed.pnpm exec turbo run test --filter=@bb/app --filter=@bb/shared-ui --filter=@bb/client-corepassed.pnpm exec turbo run lint --filter=@bb/app --filter=@bb/shared-ui --filter=@bb/client-corepassed with no errors.