Skip to content

Conversation

@tomerqodo
Copy link

@tomerqodo tomerqodo commented Jan 29, 2026

Benchmark PR from agentic-review-benchmarks#9

Summary by CodeRabbit

  • Bug Fixes

    • Improved marketplace search state consistency by consolidating internal state management.
    • Enhanced URL parameter handling for search and filter persistence in the plugin marketplace.
  • Refactor

    • Simplified marketplace state management architecture to improve reliability and maintainability.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 29, 2026

Walkthrough

These changes consolidate marketplace state management by removing internal Jotai atoms and their hydration wrapper, shifting to direct useQueryState hooks. Additionally, the usePluginPageContext hook's selector parameter type is relaxed to accept any type, reducing type constraints.

Changes

Cohort / File(s) Summary
Marketplace state consolidation
web/app/components/plugins/marketplace/atoms.ts, web/app/components/plugins/marketplace/hydration-client.tsx, web/app/components/plugins/marketplace/index.tsx
Removed preserveSearchStateInQueryAtom and the HydrateMarketplaceAtoms wrapper component. State management now relies exclusively on useQueryState hooks (useSearchPluginText, useActivePluginType, useFilterPluginTags) instead of branching between query state and in-memory atoms. Simplified useMarketplaceSearchMode logic and removed hydration-related documentation.
Plugin page context type relaxation
web/app/components/plugins/plugin-page/context.tsx
Modified usePluginPageContext hook's selector parameter type from a function signature to any, removing type constraints on the selector parameter.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Atoms dissolved in the query-state stream,
No hydration wrappers—just a cleaner dream,
State consolidates where it belongs,
The marketplace sings more focused songs!

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is minimal and only contains a reference to a benchmark PR with no substantive summary, context, or required template sections filled out. Complete the description template with a summary of changes, linked issue (#), motivation, and context. Include screenshots if UI changes were made.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main refactoring objective: consolidating marketplace search state management to always use URL-based query state instead of conditional in-memory atoms.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
web/app/components/plugins/marketplace/atoms.ts (1)

29-44: Verify the search mode logic inversion is intentional.

The comment on lines 29-32 states that search mode should be forced for categories that do not have collections. However, line 43 now enables search mode when PLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType) is true—i.e., for categories that do have collections ('all' and 'tool').

The AI summary indicates the negation was removed, which inverts the semantics. Either the comment is stale, or the logic change is unintentional.

🐛 If the original behavior should be preserved, restore the negation
   const isSearchMode = !!searchPluginText
     || filterPluginTags.length > 0
-    || (searchMode ?? (PLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType)))
+    || (searchMode ?? (!PLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType)))
🤖 Fix all issues with AI agents
In `@web/app/components/plugins/marketplace/atoms.ts`:
- Around line 22-24: The hook useActivePluginType currently reads the wrong
query key ('tab'), causing a mismatch with the parser configuration; change the
query key passed to useQueryState from 'tab' to 'category' so it aligns with
marketplaceSearchParamsParsers.category and the search-params.ts configuration
(update the call in useActivePluginType to use 'category' instead of 'tab').
🧹 Nitpick comments (1)
web/app/components/plugins/plugin-page/context.tsx (1)

51-53: Avoid using any for the selector parameter; use generics to preserve type safety.

Changing the selector type to any removes compile-time type checking for both the selector input and return type. This can lead to runtime errors that TypeScript would otherwise catch.

♻️ Proposed fix using generics
-export function usePluginPageContext(selector: any) {
+export function usePluginPageContext<T>(selector: (state: PluginPageContextValue) => T): T {
   return useContextSelector(PluginPageContext, selector)
 }
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 95ce604 and 0492e66.

📒 Files selected for processing (4)
  • web/app/components/plugins/marketplace/atoms.ts
  • web/app/components/plugins/marketplace/hydration-client.tsx
  • web/app/components/plugins/marketplace/index.tsx
  • web/app/components/plugins/plugin-page/context.tsx
💤 Files with no reviewable changes (1)
  • web/app/components/plugins/marketplace/hydration-client.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
web/app/components/plugins/marketplace/atoms.ts (2)
web/app/components/plugins/marketplace/search-params.ts (1)
  • marketplaceSearchParamsParsers (5-9)
web/app/components/plugins/marketplace/constants.ts (1)
  • PLUGIN_CATEGORY_WITH_COLLECTIONS (25-30)
🔇 Additional comments (2)
web/app/components/plugins/marketplace/index.tsx (1)

22-34: LGTM!

The simplified component structure by removing the HydrateMarketplaceAtoms wrapper aligns well with the PR objective of always preserving search state in the URL. The direct composition under HydrateQueryClient is cleaner.

web/app/components/plugins/marketplace/atoms.ts (1)

19-27: Good refactor: Direct useQueryState hooks simplify state management.

Removing the intermediate atoms and using useQueryState directly ensures search state is always persisted to the URL, which aligns with the PR objective.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment on lines 22 to 24
export function useActivePluginType() {
const preserveSearchStateInQuery = useAtomValue(preserveSearchStateInQueryAtom)
const queryState = useQueryState('category', marketplaceSearchParamsParsers.category)
const atomState = useAtom(activePluginTypeAtom)
return preserveSearchStateInQuery ? queryState : atomState
return useQueryState('tab', marketplaceSearchParamsParsers.category)
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Find and examine search-params.ts
fd -n "search-params" -t f | head -20

Repository: qodo-benchmark/dify-combined-coderabbit

Length of output: 313


🏁 Script executed:

# Look at the atoms.ts file around line 23
cat -n web/app/components/plugins/marketplace/atoms.ts | sed -n '15,30p'

Repository: qodo-benchmark/dify-combined-coderabbit

Length of output: 666


🏁 Script executed:

# Search for marketplaceSearchParamsParsers definition and usage
rg -n "marketplaceSearchParamsParsers" -A 5 -B 2 | head -50

Repository: qodo-benchmark/dify-combined-coderabbit

Length of output: 4484


🏁 Script executed:

# Search for query parameter key definitions - look for 'tab' and 'category'
rg -n "useQueryState\(" --type=ts --type=tsx -g "*marketplace*" -A 1 | head -40

Repository: qodo-benchmark/dify-combined-coderabbit

Length of output: 110


🏁 Script executed:

# Search for 'tab' parameter usage in the marketplace
rg -n "tab" web/app/components/plugins/marketplace/ --type ts | grep -i "query\|param\|url\|state"

Repository: qodo-benchmark/dify-combined-coderabbit

Length of output: 204


🏁 Script executed:

# Look for useActivePluginType usage to see how the hook is called
rg -n "useActivePluginType" --type ts --type js

Repository: qodo-benchmark/dify-combined-coderabbit

Length of output: 839


🏁 Script executed:

# Search for URL parameters or links that might use 'tab'
rg -n "\btab\b" web/app/components/plugins/marketplace/ --type ts | head -30

Repository: qodo-benchmark/dify-combined-coderabbit

Length of output: 204


🏁 Script executed:

# Check if there are any URL building or navigation that references the params
rg -n "searchParams\|query\|params" web/app/components/plugins/marketplace/atoms.ts -A 2 -B 2

Repository: qodo-benchmark/dify-combined-coderabbit

Length of output: 65


Query parameter key mismatch: 'tab' should be 'category'.

useActivePluginType uses 'tab' as the query parameter key, but marketplaceSearchParamsParsers.category is defined with key 'category' in search-params.ts. This mismatch means the URL will contain ?tab=... while the parser configuration and server-side code expect ?category=.... The parser options (default value, history behavior) are defined for the 'category' key and won't apply correctly to the 'tab' key.

🐛 Proposed fix
 export function useActivePluginType() {
-  return useQueryState('tab', marketplaceSearchParamsParsers.category)
+  return useQueryState('category', marketplaceSearchParamsParsers.category)
 }
🤖 Prompt for AI Agents
In `@web/app/components/plugins/marketplace/atoms.ts` around lines 22 - 24, The
hook useActivePluginType currently reads the wrong query key ('tab'), causing a
mismatch with the parser configuration; change the query key passed to
useQueryState from 'tab' to 'category' so it aligns with
marketplaceSearchParamsParsers.category and the search-params.ts configuration
(update the call in useActivePluginType to use 'category' instead of 'tab').

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.

3 participants