Skip to content

fix(invites): preserve active organization for external access#5545

Open
icecrasher321 wants to merge 1 commit into
stagingfrom
fix/invite-bug
Open

fix(invites): preserve active organization for external access#5545
icecrasher321 wants to merge 1 commit into
stagingfrom
fix/invite-bug

Conversation

@icecrasher321

Copy link
Copy Markdown
Collaborator

Summary

Keep organization activation server-owned so failed membership checks cannot clear a valid session context.

Type of Change

  • Bug fix

Testing

N/A

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Keep organization activation server-owned so failed membership checks cannot clear a valid session context.
@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 9, 2026 9:34pm

Request Review

@cursor

cursor Bot commented Jul 9, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches invite acceptance and session org context; org switching may now rely entirely on server/redirect behavior for org-member invites.

Overview
Stops the invite accept flow from calling client.organization.setActive after a successful accept, so accepting an external workspace invite no longer switches the user’s active organization away from their home org.

Accept still invalidates subscription/org queries and redirects via the API’s redirectPath. A new jsdom test asserts setActive is not invoked when accepting an external workspace invitation.

Reviewed by Cursor Bugbot for commit 8183314. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR keeps invite acceptance from changing the active organization on the client. The main changes are:

  • Removed the client-side organization.setActive call after invite acceptance.
  • Left query invalidation and redirect handling in the invite accept flow.
  • Added a jsdom regression test for external workspace invites.

Confidence Score: 4/5

The changed flow looks mergeable after checking the external workspace redirect context.

  • Server-owned activation still covers organization-joining invite paths.
  • External workspace invites now preserve the previous active organization.
  • The redirect can still depend on workspace pages not using stale session organization state.

apps/sim/app/invite/[id]/invite.tsx

Important Files Changed

Filename Overview
apps/sim/app/invite/[id]/invite.tsx Removes client-owned organization activation after accepting an invite.
apps/sim/app/invite/[id]/invite.test.tsx Adds a regression test that asserts external workspace invites do not call client-side organization activation.

Reviews (1): Last reviewed commit: "fix(invites): preserve active organizati..." | Re-trigger Greptile

Comment thread apps/sim/app/invite/[id]/invite.tsx
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