Skip to content

Conversation

@tomerqodo
Copy link

Benchmark PR from qodo-benchmark#415

@greptile-apps
Copy link

greptile-apps bot commented Jan 21, 2026

Greptile Summary

Refactored marketplace state management to always persist search state in URL query parameters using nuqs library, eliminating the conditional logic based on preserveSearchStateInQueryAtom.

Major changes:

  • Removed HydrateMarketplaceAtoms component and preserveSearchStateInQuery atom
  • Simplified useSearchPluginText, useActivePluginType, and useFilterPluginTags to always use useQueryState
  • Changed category parameter name from 'category' to 'tab' in URL
  • Deleted hydration-client.tsx file entirely

Critical issues found:

  • Logic error in atoms.ts:43 - removed negation operator, inverting search mode behavior for categories with/without collections
  • Type safety violation in context.tsx:51 - replaced proper function type with any

Confidence Score: 1/5

  • This PR contains a critical logic error that will break marketplace functionality
  • The inverted logic in useMarketplaceSearchMode will cause categories without collections to show collection view (which doesn't exist) instead of search mode, breaking the user experience. Additionally, the type safety regression violates project standards.
  • web/app/components/plugins/marketplace/atoms.ts requires immediate attention to fix the inverted logic on line 43. web/app/components/plugins/plugin-page/context.tsx needs type safety restored on line 51.

Important Files Changed

Filename Overview
web/app/components/plugins/marketplace/atoms.ts Simplified state management by removing conditional logic, but introduced critical logic error in search mode detection (line 43)
web/app/components/plugins/plugin-page/context.tsx Type safety degraded by replacing function type signature with any (line 51)

Sequence Diagram

sequenceDiagram
    participant User
    participant Marketplace
    participant URL as URL Query Params
    participant Atoms as State Hooks
    participant Components
    
    User->>Marketplace: Visit marketplace page
    Marketplace->>URL: Read search params (q, tab, tags)
    URL->>Atoms: useQueryState hooks initialize
    Atoms->>Components: Provide state via hooks
    
    User->>Components: Change search text
    Components->>Atoms: useSearchPluginText()[1](newValue)
    Atoms->>URL: Update 'q' param via nuqs
    URL-->>Components: Re-render with new state
    
    User->>Components: Switch plugin category
    Components->>Atoms: useActivePluginType()[1](newCategory)
    Atoms->>URL: Update 'tab' param via nuqs
    Atoms->>Atoms: Check PLUGIN_CATEGORY_WITH_COLLECTIONS
    alt Category has collections (all, tool)
        Atoms->>Atoms: Set searchMode = null (show collections)
    else Category without collections
        Atoms->>Atoms: Force searchMode = true (show search results)
    end
    URL-->>Components: Re-render with new category
    
    User->>Components: Add/remove filter tags
    Components->>Atoms: useFilterPluginTags()[1](newTags)
    Atoms->>URL: Update 'tags' param via nuqs
    URL-->>Components: Re-render with filtered results
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

const isSearchMode = !!searchPluginText
|| filterPluginTags.length > 0
|| (searchMode ?? (!PLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType)))
|| (searchMode ?? (PLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType)))
Copy link

Choose a reason for hiding this comment

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

logic: Logic inverted - negation operator missing. Categories WITH collections ('all', 'tool') should show collection view by default, while categories WITHOUT collections should force search mode. The original logic !PLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType) was correct.

Suggested change
|| (searchMode ?? (PLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType)))
|| (searchMode ?? (!PLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType)))
Prompt To Fix With AI
This is a comment left during a code review.
Path: web/app/components/plugins/marketplace/atoms.ts
Line: 43:43

Comment:
**logic:** Logic inverted - negation operator missing. Categories WITH collections (`'all'`, `'tool'`) should show collection view by default, while categories WITHOUT collections should force search mode. The original logic `!PLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType)` was correct.

```suggestion
    || (searchMode ?? (!PLUGIN_CATEGORY_WITH_COLLECTIONS.has(activePluginType)))
```

How can I resolve this? If you propose a fix, please make it concise.

}

export function usePluginPageContext(selector: (value: PluginPageContextValue) => any) {
export function usePluginPageContext(selector: any) {
Copy link

Choose a reason for hiding this comment

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

syntax: Using any type violates TypeScript type safety standards (AGENTS.md rule #9). The original type signature (value: PluginPageContextValue) => any should be preserved.

Suggested change
export function usePluginPageContext(selector: any) {
export function usePluginPageContext(selector: (value: PluginPageContextValue) => any) {

Context Used: Context from dashboard - AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: web/app/components/plugins/plugin-page/context.tsx
Line: 51:51

Comment:
**syntax:** Using `any` type violates TypeScript type safety standards (AGENTS.md rule #9). The original type signature `(value: PluginPageContextValue) => any` should be preserved.

```suggestion
export function usePluginPageContext(selector: (value: PluginPageContextValue) => any) {
```

**Context Used:** Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=1028e8c2-7220-42d3-94ac-c7ba65fc7240))

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

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