refactor: always preserve marketplace search state in URL - #22
Conversation
| 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 causes incorrect marketplace display
The logic for determining search mode in useMarketplaceSearchMode was inverted by removing the negation operator !.
Click to expand
Original Logic
|| (searchMode ?? (!PLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType)))New (Buggy) Logic
|| (searchMode ?? (PLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType)))Impact
The comment at atoms.ts:29-32 states: "Not all categories have collections, so we need to force the search mode for those categories."
PLUGIN_CATEGORY_WITH_COLLECTIONScontains['all', 'tool'](categories that have collections)- Expected behavior: Categories WITHOUT collections (model, agent, extension, datasource, trigger, bundle) should default to search mode (
isSearchMode = true) - Actual behavior: Categories WITH collections (all, tool) now default to search mode, while categories without collections default to collection view
This causes:
- For
model,agent,extension,datasource,trigger,bundlecategories: The UI will try to renderListWithCollectionwith empty collections instead of showing search results - For
allandtoolcategories: The UI will show search results instead of the curated collections view
In state.ts:22-24, when isSearchMode is false, queryParams becomes undefined, which means pluginsQuery won't fetch any plugins. The list/index.tsx:30-38 then renders ListWithCollection which expects collections data that doesn't exist for most categories.
Recommendation: Restore the negation operator: change (PLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType)) back to (!PLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType))
Was this helpful? React with 👍 or 👎 to provide feedback.
Benchmark PR from qodo-benchmark#415