Repository navigation
Keep a workspace switch on the account at once, and stop a new browser wiping it - #1756
Conversation
…rowser no longer wipes it The first-use walker Daniel switched to his organization from the account menu, never reloaded, and the next day's new browser opened in his own workspace: the account was told only on a page load, which a switch doesn't make. The switch, and making a new organization, now tell it as they happen. Replaying it then showed the account wiped: a new browser's first page shows the person's own workspace before it has asked, the cookie remembered that, and the proxy told the account "own workspace". The proxy now tells the account only of organizations; moving back to one's own workspace is told by the switch itself. Checked on a local build against shared dev with Clerk's real sign-in page: day one signs in, switches from the menu and opens an own-workspace page; day two, on a new browser, signs in and lands in the organization, and /publish opens there too.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3719601c87
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| onSwitch={(slug, to) => { | ||
| close(); | ||
| if (to) setPicked(to); | ||
| void rememberWorkspace({ slug: slug ?? null }).catch(() => undefined); |
There was a problem hiding this comment.
Update the cookie's saved marker after remembering a switch
When the cookie already has saved: A, switching to B now updates the account to B but leaves saved at A. If the user then returns to A through a client-side path other than the account switcher—for example, moving an item into A through components/workspaces/move-dialog.tsx—LastWorkspace sets the cookie's last to A. Subsequent page loads see last === saved, so keepOnAccount skips the write indefinitely even though the account still remembers B; a new browser consequently opens in the wrong organization. Update or invalidate the cookie's saved marker when the new mutation succeeds so the proxy's deduplication remains accurate.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 5dbd12f: a switch now writes what it told the account into the cookie's saved, so moving back to A another way is told again. Test: lib/workspaces/look-cache.test.ts.
Codex review: with the cookie saying the account was told A, a switch to B told the account but left the note at A; moving back to A another way (an item moved there) then looked already told, and the account kept B. A switch now notes what it told, through one hook the switcher and new organizations share (lib/workspaces/remember.ts).
…orkspace The sidebar now tells the account of a switch (lib/workspaces/remember.ts); its test's stand-in for the generated API lacked that function.
Follows #1755. Found by the first-use walker Daniel.
What went wrong. Daniel switched to his organisation from the account menu and never reloaded. The next day his new browser opened in his own workspace. The account was told only on a full page load, and switching workspace doesn't do one. The switch, and making a new organisation, now tell the account as they happen (
rail.tsx,switcher.tsx).Found while replaying it. The account was being wiped. A new browser's first page shows the person's own workspace before it has asked the account. The cookie remembered that, and the proxy then told the account "own workspace". The proxy now tells the account only about organisations. Moving back to your own workspace is told by the switch itself.
Checks
tscand Vitestlib/workspacesandconvex/workspacespass./o/rift-valley-water-board…,/publishopens there too, and the account still holds the board.