Repository navigation
Open where you last worked on a new browser, and point to your reports elsewhere - #1755
Conversation
…ish points to your reports elsewhere A walker who belonged to an institute came back on a new browser: Publish opened a blank report in her own workspace, and nothing said her institute's report, waiting for review, was there. The organization a person last worked in was kept only in a browser cookie. The account keeps it too (users.lastWorkspace, workspaces/lastUsed): a page opened in a workspace other than the one remembered saves it, and a browser with no memory of the person asks the account at a start address (proxy.ts), as Vercel's default team works from any device. A browser that does remember keeps its own memory. Publish's notice of reports in the person's other workspaces now covers every organization they are in, and says how many of their own reports there aren't live yet (being worked on, checked, reviewed or declined), besides the ones ready for them to activate. The sidebar's count still counts only those ready.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eba5aaffe8
ℹ️ 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".
| const next = writeCache(usedLast(readCache(raw, userId), lookKey(named)), userId, lookKey(named), undefined, undefined); | ||
| if (next && next !== raw) document.cookie = lookCookieOut(next); | ||
| }, [userId, named, pathname, query]); | ||
| if (was !== (named ?? null)) void remember({ slug: named ?? null }).catch(() => undefined); |
There was a problem hiding this comment.
Persist the account workspace independently of the cookie effect
For an existing user whose browser already remembers their organization, was equals named, so opening pages there never calls remember. Since this commit introduces users.lastWorkspace without backfilling it, their account remains unset, and a new browser still opens their personal workspace even after they have continued working in the organization. Initialize the account preference independently of whether the browser cookie changes. Also keep the account mutation outside this cookie-synchronization effect: AGENTS.md explicitly prohibits mutations in React effects and limits effects to external browser synchronization.
AGENTS.md reference: AGENTS.md:L85-L90
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 88b61d4: the proxy now tells the account whenever the cookie's memory differs from what it last told it (tracked as saved in the cookie), so a browser that already remembered the organization backfills on its next page load, and the React effect only writes the cookie.
… reports by owner Codex review: a browser that already remembered the organization never told the account, and the account was told from a React effect, which the repository's rules keep for outside systems. The cookie now records what the account was last told (saved), and the proxy tells it on a page load when the two differ: once per change, and once for a person who had nothing saved. Cross-family review: a person's own unfinished reports are read by owner (new index by_ownerId_and_activatedAt), so a colleague's 200 newer reports never hide them; organizations the person runs are asked about first, so their ready reports still reach the sidebar's count; and a workspace with both ready and unfinished reports gets a line for each.
Found by the first-use walk on #1746. Amina, a member of an institute, came back on a new browser. Publish opened a blank report in her own workspace. Nothing said her institute's report, which was waiting for review, was there. She found it only through the account menu.
Your account remembers where you last worked (
users.lastWorkspace,workspaces/lastUsed)./,/results,/publish), a browser with no memory of the person asks the account (proxy.ts). So does one holding another person's cookie.getsends nobody into an organisation they've left or never belonged to.Publish points to your reports in other workspaces. Its notice now covers every organisation the person is in, not only those they're an admin of.
convex/_generated/api.d.tsgains the new module's two lines by hand. Codegen pushes to a deployment, and this branch mustn't push to shared dev.Checks
tsc,check:ui-rules,check:convex-rulesandcheck:user-actionspass.convex/reports,convex/workspacesandlibpass (2,406 tests).