[WEB-4160]: Context menu close after clicking on menu item of project#7231
[WEB-4160]: Context menu close after clicking on menu item of project#7231sriramveeraghanta merged 1 commit intopreviewfrom
Conversation
… improved user experience
WalkthroughThe navigation logic within the project sidebar menu items was refactored from using declarative Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant MenuItem
participant Router
User->>MenuItem: Clicks menu item
MenuItem->>Router: Calls router.push(targetUrl)
Router-->>User: Navigates to new page
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Pull Request Linked with Plane Work Items Comment Automatically Generated by Plane |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
web/core/components/workspace/sidebar/projects-list-item.tsx (3)
80-80: Minor: cache the router instance outside render if possibleThe call to
useRouter()is fine, but note it returns a new proxy on every render.
If the component re-renders very frequently (drag-and-drop, sidebar toggling) and you only needrouter.push, consider extracting the push function:const { push } = useRouter();This avoids recreating the full proxy on each render. Not critical—just a micro-optimisation.
356-365: Avoid optional-chaining in paths – it can yield “undefined” in the URL
projectis guaranteed to be defined (wereturn nullabove when it isn't), so the
optional chain isn’t needed and can silently produce an “undefined” segment if the
types ever change:- router.push(`/${workspaceSlug}/projects/${project?.id}/archives/issues`); + router.push(`/${workspaceSlug}/projects/${project.id}/archives/issues`);Same applies to the settings route below.
369-376: Keep the menu closed explicitly after navigation (defensive UX)
CustomMenureceivescloseOnSelect, but if the prop changes or the implementation
is altered the menu could remain open. Add a defensive close to be safe:- router.push(`/${workspaceSlug}/settings/projects/${project.id}`); + router.push(`/${workspaceSlug}/settings/projects/${project.id}`); + setIsMenuActive(false);This keeps behaviour identical to the previous implementation that called
setIsMenuActive(false)manually.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
web/core/components/workspace/sidebar/projects-list-item.tsx(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
web/core/components/workspace/sidebar/projects-list-item.tsx (1)
10-10: Confirmnext/navigationis the right router for this file
useRouteris now imported fromnext/navigation, which only works under the App Router.
Double-check that this component is rendered exclusively from the/apptree; mixing it inside a legacy pages tree will break at runtime becausenext/navigationwon’t be initialised there.
Description
Context menu close after clicking on menu item of project
Type of Change
Screenshots and Media (if applicable)
Screen.Recording.2025-06-17.at.8.49.26.PM.mov
Summary by CodeRabbit