Skip to content

Open where you last worked on a new browser, and point to your reports elsewhere - #1755

Merged
sickerine merged 2 commits into
devfrom
feat/remember-workspace
Dec 6, 2026
Merged

sickerine merged 2 commits into
devfrom
feat/remember-workspace

Conversation

@sickerine

Copy link
Copy Markdown
Collaborator

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).

  • Opening a page in a workspace other than the one remembered saves it. The browser's cookie still saves it too.
  • At a start address (/, /results, /publish), a browser with no memory of the person asks the account (proxy.ts). So does one holding another person's cookie.
  • A browser that does remember keeps its own memory, so a tab kept in the person's own workspace doesn't jump.
  • get sends nobody into an organisation they've left or never belonged to.
  • This copies Vercel's default team, which opens from any device. Here it's set automatically.

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.

  • It still says how many reports are ready for them to activate, where they can.
  • It now also counts their own reports that aren't live yet: being worked on, checked, reviewed or declined. For example: "You have 1 report in Lake Basin Health Institute that isn't live yet." with Open it.
  • The sidebar's count on Publish still counts only reports ready to activate.

convex/_generated/api.d.ts gains 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-rules and check:user-actions pass.
  • Vitest convex/reports, convex/workspaces and lib pass (2,406 tests).
    • The new test covers the account keeping an organisation and going back to the person's own workspace, and refusing a non-member or someone who left.
    • The other-workspaces test now expects the member who made a lab report to be told it isn't live yet. It used to say a member is told nothing, which is the gap this closes.
  • Not run in a browser yet: the proxy needs the new query deployed. The walker wave after the merge runs it on a new browser.

…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.
@coderabbitai

coderabbitai Bot commented Dec 5, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dfa13b0d-ec8f-46c4-96fd-b838ffb5d3dc
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-05T23:51:53.868101Z eba5aaf PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread components/workspaces/item-home.tsx Outdated
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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@sickerine
sickerine merged commit 137ed2a into dev Dec 6, 2026
6 checks passed
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