Skip to content

fix: redirect active project and organization selections#7724

Merged
Dhruwang merged 2 commits into
mainfrom
cursor/project-org-self-click-redirect-9494
Apr 17, 2026
Merged

fix: redirect active project and organization selections#7724
Dhruwang merged 2 commits into
mainfrom
cursor/project-org-self-click-redirect-9494

Conversation

@jobenjada
Copy link
Copy Markdown
Member

@jobenjada jobenjada commented Apr 13, 2026

What does this PR do?

When users click the currently selected item in either navigation switcher, it now performs a meaningful redirect instead of doing nothing:

  • Current Project/Workspace selection redirects to the Survey list (/environments/[environmentId]/surveys)
  • Current Organization selection redirects to General organization settings (/environments/[environmentId]/settings/general)

This behavior is implemented in both places where switching is available:

  • Top breadcrumb switchers (project-breadcrumb.tsx, organization-breadcrumb.tsx)
  • Lower-right sidebar switchers (MainNavigation.tsx)

Fixes #(issue)

How should this be tested?

Manual validation:

  • Open an environment page and click the project breadcrumb, then select the currently checked workspace.
    • Verify navigation goes to the survey list page.
  • Open the organization breadcrumb and select the currently checked organization.
    • Verify navigation goes to organization general settings.
  • In the left sidebar lower-right switchers, repeat both actions and verify the same redirects.

Automated check attempted:

  • pnpm --filter @formbricks/web lint -- "app/(app)/environments/[environmentId]/components/MainNavigation.tsx" "app/(app)/environments/[environmentId]/components/project-breadcrumb.tsx" "app/(app)/environments/[environmentId]/components/organization-breadcrumb.tsx"
  • Result: could not run in this environment because dependencies are not installed (eslint: not found, node_modules missing).

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read How we Code at Formbricks
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand bits
  • Ran pnpm build
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues
  • First PR at Formbricks? Please sign the CLA! Without it we wont be able to merge it 🙏

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the Formbricks Docs if changes were necessary
Open in Web Open in Cursor 

@jobenjada jobenjada marked this pull request as ready for review April 13, 2026 12:58
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 13, 2026

Walkthrough

This pull request updates navigation handlers across three component files to remove early-return behavior when users switch to their currently selected workspace, organization, or project. The changes compute conditional destination routes and ensure dropdowns are explicitly closed before navigation. The modifications affect handleProjectChange and handleOrganizationChange methods in MainNavigation.tsx, organization-breadcrumb.tsx, and project-breadcrumb.tsx, allowing navigation to appropriate settings pages instead of silently exiting when switching to the current selection.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: implementing redirect behavior when users select the currently active project or organization in navigation switchers.
Description check ✅ Passed The description comprehensively covers what the PR does, how to test it manually, and includes a completed checklist with most required items checked.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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


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

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

Copy link
Copy Markdown
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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@apps/web/app/`(app)/environments/[environmentId]/components/organization-breadcrumb.tsx:
- Around line 117-127: The early return when organizationId ===
currentOrganizationId prevents closing the dropdown and navigating when
currentEnvironmentId is undefined; update the handler that uses startTransition,
setIsOrganizationDropdownOpen, and router.push so it always calls
setIsOrganizationDropdownOpen(false) and navigates: if currentEnvironmentId
exists route to `/environments/${currentEnvironmentId}/settings/general`,
otherwise fall back to `/organizations/${organizationId}/`; remove the early
return and ensure both branches run inside startTransition so the dropdown is
always closed and a fallback navigation is performed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0fb101c2-be3c-41a6-ad9b-664ebea2612e

📥 Commits

Reviewing files that changed from the base of the PR and between cc0eec3 and 363df0a.

📒 Files selected for processing (3)
  • apps/web/app/(app)/environments/[environmentId]/components/MainNavigation.tsx
  • apps/web/app/(app)/environments/[environmentId]/components/organization-breadcrumb.tsx
  • apps/web/app/(app)/environments/[environmentId]/components/project-breadcrumb.tsx

@jobenjada jobenjada requested a review from Dhruwang April 13, 2026 13:28
@sonarqubecloud
Copy link
Copy Markdown

@Dhruwang Dhruwang added this pull request to the merge queue Apr 17, 2026
Merged via the queue into main with commit b1cee91 Apr 17, 2026
17 checks passed
@Dhruwang Dhruwang deleted the cursor/project-org-self-click-redirect-9494 branch April 17, 2026 09:48
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