fix: redirect active project and organization selections#7724
Conversation
Co-authored-by: Johannes <[email protected]>
WalkthroughThis 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 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ 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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (3)
apps/web/app/(app)/environments/[environmentId]/components/MainNavigation.tsxapps/web/app/(app)/environments/[environmentId]/components/organization-breadcrumb.tsxapps/web/app/(app)/environments/[environmentId]/components/project-breadcrumb.tsx
|



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:
/environments/[environmentId]/surveys)/environments/[environmentId]/settings/general)This behavior is implemented in both places where switching is available:
project-breadcrumb.tsx,organization-breadcrumb.tsx)MainNavigation.tsx)Fixes #(issue)
How should this be tested?
Manual validation:
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"eslint: not found,node_modules missing).Checklist
Required
pnpm buildconsole.logsgit pull origin mainAppreciated