refactor: always preserve marketplace search state in URL#9
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| const isSearchMode = !!searchPluginText | ||
| || filterPluginTags.length > 0 | ||
| || (searchMode ?? (!PLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType))) | ||
| || (searchMode ?? (PLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType))) |
There was a problem hiding this comment.
Inverted search mode logic breaks category handling
High Severity
The removal of the ! operator inverts the isSearchMode logic. The comment states that search mode should be forced for categories that don't have collections. The original code used !PLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType) to enable search mode when a category lacks collections. The new code PLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType) does the opposite—it enables search mode for categories that have collections (all, tool) instead of those without (model, agent, extension, etc.).
| const queryState = useQueryState('category', marketplaceSearchParamsParsers.category) | ||
| const atomState = useAtom(activePluginTypeAtom) | ||
| return preserveSearchStateInQuery ? queryState : atomState | ||
| return useQueryState('tab', marketplaceSearchParamsParsers.category) |
There was a problem hiding this comment.
Server-client URL parameter name mismatch breaks hydration
Medium Severity
The useActivePluginType hook now uses 'tab' as the URL parameter name, but the server-side hydration in hydration-server.tsx uses createLoader(marketplaceSearchParamsParsers) which expects the parameter to be named category (from the object key). This mismatch means the server will read from ?category=xxx while the client writes/reads ?tab=xxx, breaking server-side prefetching and causing hydration issues for category-based navigation.
Benchmark PR from agentic-review-benchmarks#9
Note
Simplifies marketplace state by relying solely on URL query params and removing Jotai-based preservation.
preserveSearchStateInQueryAtomandHydrateMarketplaceAtoms; all hooks now usenuqs(useQueryState) directlyuseSearchPluginText('q'),useActivePluginType('tab'),useFilterPluginTags('tags'); drop local atomsPLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType)Marketplacecomponent to drop client hydration wrapper; structure unchanged otherwiseusePluginPageContextselector typing toany(no functional change)Written by Cursor Bugbot for commit 0492e66. Configure here.