Skip to content

Replace plugin Browse with category shelves - #2941

Merged
SawyerHood merged 1 commit into
mainfrom
browse-category-shelves
Sep 2, 2026
Merged

SawyerHood merged 1 commit into
mainfrom
browse-category-shelves

Conversation

@SawyerHood

@SawyerHood SawyerHood commented Sep 2, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Browse grouped plugins by publisher. It did not use category and collection data from marketplace v2.

What changed

  • Browse now shows collection shelves, category shelves, and a final More plugins shelf.
  • Collection shelves keep the exact server order without a special collection ID.
  • Search, repeated category filters, and three sort choices use URL parameters.
  • Recently added and Most installed show one flat list with category labels.
  • Cards now show neutral icons, author art, install counts, and compact install actions.
  • Each catalog icon path now uses one tile and one glyph box.
  • Installed cards now show a non-interactive check state and keep the install count.
  • One plugin detail tab now opens beside Browse and keeps Browse mounted.
  • The detail shows screenshots, author data, About, source, listing date, configuration, capabilities, and install state.
  • This change has no wire, CLI, guide, or public API changes.

Visual QA

State Main This branch
Default Browse Main Browse groups plugins by publisher Browse shows collection and category shelves
Category control Main category control Searchable category control with counts and checkboxes
Most installed Main Browse before the flat sort Flat Most installed list with category labels
Plugin detail Main full-page plugin detail Plugin detail beside mounted Browse

Catalog icon alignment

Notifications shelf with aligned bundled and community icons, plus an installed card

How you verified

  • The new tests cover shelf order, URL filters, missing sort values, detail content, and focus return.
  • Review tests cover install-count gating, narrow shelves, category order, isolated menu focus, and installed detail labels.
  • pnpm exec turbo run typecheck --filter=@bb/app --filter=@bb/shared-ui --filter=@bb/client-core passed.
  • pnpm exec turbo run test --filter=@bb/app --filter=@bb/shared-ui --filter=@bb/client-core passed.
  • The synced app suite passed 3,768 tests. Three tests remained skipped.
  • The focused catalog icon and card tests passed 19 tests.
  • The focused shelf-order test passed 5 tests.
  • The client-core suite passed 253 tests.
  • Shared UI has no test script. Turbo included it in the requested scope.
  • pnpm exec turbo run lint --filter=@bb/app --filter=@bb/shared-ui --filter=@bb/client-core passed with no errors.
  • Live QA compared main and this branch at 1440 by 900.
  • Live QA also verified that the hero chips hide beside an open detail panel.
  • Live QA verified 40-pixel tiles and 24-pixel glyph boxes across all icon sources.
  • Live QA verified the same icon sizes in flat cards and the detail header.
  • The branch browser console showed no errors.

AGENT GENERATED

@SawyerHood SawyerHood changed the title browse category shelves Replace plugin Browse with category shelves Sep 2, 2026
@SawyerHood
SawyerHood marked this pull request as ready for review September 2, 2026 17:05
@bb-slop-cop

bb-slop-cop Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🚨 SLOP COP 🚨 · review

I am SlopCop. I am reviewing this pull request for security, code quality, performance, architecture, and user behavior.

Comment thread apps/app/src/views/ToolsView.tsx Outdated
const [installTarget, setInstallTarget] =
useState<PluginCatalogSearchEntry | null>(null);
const listQuery = usePluginList({ enabled: true });
const catalogQuery = usePluginCatalogSearch(pluginId, { enabled: true });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 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 }),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 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(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 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("");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 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.

Comment thread apps/app/src/app.css Outdated
}

@container plugin-shelf (max-width: 48.999rem) {
[data-plugin-shelf-grid] > :nth-child(n + 5) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 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.

@bb-slop-cop bb-slop-cop Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 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.

@SawyerHood
SawyerHood force-pushed the browse-category-shelves branch 3 times, most recently from 362d27f to 0279e96 Compare September 2, 2026 18:01
@SawyerHood
SawyerHood force-pushed the browse-category-shelves branch 2 times, most recently from cb2d31a to c3ab175 Compare September 2, 2026 19:01
@SawyerHood
SawyerHood force-pushed the browse-category-shelves branch from c3ab175 to abe1f46 Compare September 2, 2026 19:09
@SawyerHood
SawyerHood merged commit 6b68242 into main Sep 2, 2026
15 checks passed
@SawyerHood
SawyerHood deleted the browse-category-shelves branch September 2, 2026 19:37
SawyerHood added a commit that referenced this pull request Sep 22, 2026
## 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]>
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