Skip to content

refactor: always preserve marketplace search state in URL#9

Open
tomerqodo wants to merge 2 commits into
cursor_full_base_refactor_always_preserve_marketplace_search_state_in_url_pr9from
cursor_full_head_refactor_always_preserve_marketplace_search_state_in_url_pr9
Open

refactor: always preserve marketplace search state in URL#9
tomerqodo wants to merge 2 commits into
cursor_full_base_refactor_always_preserve_marketplace_search_state_in_url_pr9from
cursor_full_head_refactor_always_preserve_marketplace_search_state_in_url_pr9

Conversation

@tomerqodo

@tomerqodo tomerqodo commented Jan 25, 2026

Copy link
Copy Markdown

Benchmark PR from agentic-review-benchmarks#9


Note

Simplifies marketplace state by relying solely on URL query params and removing Jotai-based preservation.

  • Remove preserveSearchStateInQueryAtom and HydrateMarketplaceAtoms; all hooks now use nuqs (useQueryState) directly
  • Update hooks: useSearchPluginText('q'), useActivePluginType('tab'), useFilterPluginTags('tags'); drop local atoms
  • Adjust search-mode condition to use PLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType)
  • Cleanup Marketplace component to drop client hydration wrapper; structure unchanged otherwise
  • Loosen usePluginPageContext selector typing to any (no functional change)

Written by Cursor Bugbot for commit 0492e66. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Fix in Cursor Fix in Web

const queryState = useQueryState('category', marketplaceSearchParamsParsers.category)
const atomState = useAtom(activePluginTypeAtom)
return preserveSearchStateInQuery ? queryState : atomState
return useQueryState('tab', marketplaceSearchParamsParsers.category)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

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.

2 participants