refactor: always preserve marketplace search state in URL#22
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.
Search mode logic inverted, breaking collection display
High Severity
The negation operator was accidentally removed from the search mode condition. The comment states that search mode needs to be forced for categories without collections, but the new code PLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType) does the opposite—it forces search mode for categories that have collections ('all' and 'tool'). Categories like 'model', 'agent', 'extension' that lack collections will no longer default to search mode, breaking the marketplace display logic.
| 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.
Client-server URL parameter name mismatch for category
High Severity
useActivePluginType() now uses 'tab' as the URL query parameter, but the server-side hydration in hydration-server.tsx reads from params.category (the key in marketplaceSearchParamsParsers). This mismatch means server-side prefetching won't recognize the tab parameter, causing hydration failures and incorrect data loading when users navigate with category-filtered URLs.
Benchmark PR from qodo-benchmark#415
Note
Streamlines marketplace state to always come from URL query params and removes client atom hydration.
preserveSearchStateInQueryAtom, local atoms, andHydrateMarketplaceAtoms; marketplace hooks now directly usenuqs(useQueryState) forq,tags, and active tabcategorytotabin marketplace; plugin page context still usescategoryPLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType)instead of its negationhydration-client.tsxand its usage inindex.tsx; no functional changes to server hydrationusePluginPageContextselector typing (from function type toany)Written by Cursor Bugbot for commit 647d6af. Configure here.