Skip to content

fix: use activeOrganizationId for org redirect on app open#2444

Merged
Marfuen merged 2 commits intomainfrom
mariano/fix-org-switcher-persistence
Apr 2, 2026
Merged

fix: use activeOrganizationId for org redirect on app open#2444
Marfuen merged 2 commits intomainfrom
mariano/fix-org-switcher-persistence

Conversation

@Marfuen
Copy link
Copy Markdown
Contributor

@Marfuen Marfuen commented Apr 2, 2026

Summary

  • The root page (/) was picking the first "ready" org from the memberships list, ignoring the session's activeOrganizationId
  • This caused users to land on the wrong org after switching orgs and reopening the app
  • Now always respects activeOrganizationId from the session, falling back to the previous behavior only for new users without an active org

Test plan

  • Switch to a non-default org in the org switcher
  • Close the browser window
  • Reopen the app — should land on the org you last switched to

🤖 Generated with Claude Code

The root page was picking the first "ready" org from the memberships
list, ignoring the session's activeOrganizationId. This caused users
to land on the wrong org after switching orgs and reopening the app.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Apr 2, 2026 9:19pm
comp-framework-editor Ready Ready Preview, Comment Apr 2, 2026 9:19pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
portal Skipped Skipped Apr 2, 2026 9:19pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 2, 2026

PR Summary

Low Risk
Low risk: changes are limited to server-side redirect target selection and only affect which organization ID is chosen, with fallbacks preserved when no active org is set.

Overview
Redirect logic for /, /setup, and /admin now prefers the session’s activeOrganizationId when choosing which organization to land in, instead of defaulting to the first (or first “ready”) membership.

If the active org isn’t present, behavior falls back to the previous first-org selection, keeping existing onboarding/upgrade redirects intact.

Written by Cursor Bugbot for commit a2ad590. This will update automatically on new commits. Configure here.

Same issue as root page — these layouts picked organizations[0]
instead of respecting the session's activeOrganizationId.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel vercel bot temporarily deployed to Preview – portal April 2, 2026 21:17 Inactive
@Marfuen Marfuen merged commit 79fb25d into main Apr 2, 2026
9 of 10 checks passed
@Marfuen Marfuen deleted the mariano/fix-org-switcher-persistence branch April 2, 2026 21:19
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.

1 participant