Skip to content

[WEB-4160]: Context menu close after clicking on menu item of project#7231

Merged
sriramveeraghanta merged 1 commit intopreviewfrom
fix-project-context-menu
Jun 18, 2025
Merged

[WEB-4160]: Context menu close after clicking on menu item of project#7231
sriramveeraghanta merged 1 commit intopreviewfrom
fix-project-context-menu

Conversation

@JayashTripathy
Copy link
Member

@JayashTripathy JayashTripathy commented Jun 17, 2025

Description

Context menu close after clicking on menu item of project

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Screenshots and Media (if applicable)

Screen.Recording.2025-06-17.at.8.49.26.PM.mov

Summary by CodeRabbit

  • Refactor
    • Updated project sidebar menu navigation to use programmatic routing for improved menu item interactions.
    • Enhanced menu item styling with a pointer cursor for better user feedback.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 17, 2025

Walkthrough

The navigation logic within the project sidebar menu items was refactored from using declarative Link components to imperative navigation with router.push. The useRouter and useParams hooks from Next.js are now used, and click handlers were updated to trigger navigation programmatically.

Changes

File(s) Change Summary
web/core/components/workspace/sidebar/projects-list-item.tsx Replaced Link with router.push for menu item navigation; updated imports and click handlers.

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
Loading

Possibly related PRs

Suggested labels

🐛bug, 🌐frontend, ready to merge

Suggested reviewers

  • anmolsinghbhatia
  • sriramveeraghanta

Poem

A bunny hops from Link to push,
With router’s help, there’s less a rush.
Click a menu, off you go—
To settings, archives, in one smooth flow.
No more wrappers, just a route,
The sidebar’s smarter, there’s no doubt!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@makeplane
Copy link

makeplane bot commented Jun 17, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

Copy link
Contributor

@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: 0

🧹 Nitpick comments (3)
web/core/components/workspace/sidebar/projects-list-item.tsx (3)

80-80: Minor: cache the router instance outside render if possible

The 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 need router.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

project is guaranteed to be defined (we return null above 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)

CustomMenu receives closeOnSelect, 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

📥 Commits

Reviewing files that changed from the base of the PR and between 89b8cdb and 76c5f77.

📒 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: Confirm next/navigation is the right router for this file

useRouter is now imported from next/navigation, which only works under the App Router.
Double-check that this component is rendered exclusively from the /app tree; mixing it inside a legacy pages tree will break at runtime because next/navigation won’t be initialised there.

@sriramveeraghanta sriramveeraghanta merged commit 9cdfb22 into preview Jun 18, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the fix-project-context-menu branch June 18, 2025 10:03
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.

2 participants