feat: Add switch organization to project switcher#2365
Open
charlesvien wants to merge 3 commits into
Open
Conversation
Member
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced May 25, 2026
Contributor
What T-Rex did
ArtifactsVerbose vitest output for generated org switcher checks
Generated targeted org switcher tests
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
apps/code/src/renderer/features/sidebar/components/ProjectSwitcher.tsx:146-149
**Prevent wrong-org fallback**
When this switches orgs and navigates straight back to task input, `useProjects()` can run its fallback project selection while auth state is still settling. That hook flattens `orgProjectsMap` across every organization, so if the current project is stale or missing after switching to `org-2`, it can call `selectProject` for the first project from `org-1`. The main auth service then moves `currentOrgId` back to the org that owns that project, leaving the user in the wrong organization. Please constrain the fallback to the selected org, or wait/gate navigation until the switched org's project state is settled.
Reviews (1): Last reviewed commit: "navigate after org switch and guard doub..." | Re-trigger Greptile |
c8e3d0e to
1382e6f
Compare
70022a3 to
6670280
Compare
6670280 to
9dfa96d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
After #2364 the renderer knows every org the user belongs to, but there is no in-app way to switch between them. Users would have to log out or change orgs in the PostHog web app.
Changes
ProjectSwitcherdropdownorgProjectsMap, mark the current one, hide the submenu when there is only one orguseSwitchOrgMutationon click and navigate to task input on successHow did you test this?
manually
Publish to changelog?
no