fix(context-menu): make divider on context menu aware of available options#2766
fix(context-menu): make divider on context menu aware of available options#2766waleedlatif1 merged 1 commit intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryThis PR makes two unrelated but clean improvements to the codebase: Context Menu Divider Logic (Primary Change)What changed: The context menu now intelligently shows/hides dividers based on whether menu sections actually have visible items, not just whether the section flags are enabled. Why this matters: The old implementation had a bug where dividers would appear even when no menu items existed in a section. For example:
Implementation: Three boolean flags track section visibility:
These flags are used to conditionally render dividers, preventing empty sections from creating visual clutter with unnecessary dividers. Edge cases handled correctly:
Avatar Component Cleanup (Secondary Change)What changed: Removed the unused Impact: Safe removal - no usages found in codebase outside the playground examples. The component still supports Changes:
Both changes improve code quality: the context menu fix prevents UI bugs with orphaned dividers, and the Avatar cleanup removes dead code. Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant ContextMenu
participant MenuItem
participant Divider
User->>ContextMenu: Right-click item
ContextMenu->>ContextMenu: Calculate section visibility
Note over ContextMenu: hasNavigationSection = showOpenInNewTab && onOpenInNewTab
Note over ContextMenu: hasEditSection = (showRename && onRename) || (showCreate && onCreate) || (showCreateFolder && onCreateFolder)
Note over ContextMenu: hasCopySection = (showDuplicate && onDuplicate) || (showExport && onExport)
alt hasNavigationSection
ContextMenu->>MenuItem: Render "Open in new tab"
alt hasEditSection OR hasCopySection
ContextMenu->>Divider: Render divider
end
end
alt hasEditSection
ContextMenu->>MenuItem: Render Edit items (Rename/Create/CreateFolder)
alt hasCopySection
ContextMenu->>Divider: Render divider
end
end
alt hasCopySection
ContextMenu->>MenuItem: Render Copy items (Duplicate/Export)
end
alt hasNavigationSection OR hasEditSection OR hasCopySection
ContextMenu->>Divider: Render divider before Delete
end
ContextMenu->>MenuItem: Render "Delete" (always visible)
ContextMenu->>User: Display context menu
|
Summary
Type of Change
Testing
Tested manually
Checklist