Repository navigation
feat(frontend): hide demo workspaces and projects from the UI - #5142
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Important Review skippedToo many files! This PR contains 1926 files, which is 1776 over the limit of 150. To get a review, narrow the scope: Upgrade to a paid plan to raise the limit. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (258)
📒 Files selected for processing (1926)
You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
|
| let last = 0 | ||
| let m: RegExpExecArray | null | ||
| TOKEN_RE.lastIndex = 0 | ||
| while ((m = TOKEN_RE.exec(template)) !== null) { |
| "content-type": "application/json", | ||
| "content-length": Buffer.byteLength(payload), | ||
| }); | ||
| res.end(payload); |
| if (!isPlainObject(cursor[key])) cursor[key] = {}; | ||
| cursor = cursor[key] as Record<string, unknown>; | ||
| } | ||
| cursor[parts[parts.length - 1]] = value; |
Context
Demo workspaces and projects still show up in the org switcher and project picker (sorted last), even though we no longer use them. They clutter the UI and can capture the "last used project", so redirects sometimes land users in the demo workspace.
Changes
Demo orgs and demo projects are now filtered out of the two central atoms every picker and redirect reads from, instead of being sorted last.
Before:
orgsAtomappliedsortOrgsWithDemoLast, so demo orgs appeared at the bottom of the org switcher and demo projects appeared in the project picker.After:
orgsAtomappliesfilterOutDemoOrgsandprojectsAtomappliesfilterOutDemoProjects. Both use the same rule: drop demo entries, unless they are all the user has, in which case keep them so the UI is not left empty.Two real leaks needed fixing beyond the atoms:
useOrgData().orgsanduseProjectData().projectsreturned the raw query data, bypassing the atoms. The sidebar project picker and the EE post-signup flow read those. Both hooks now return the filtered atom values.The fallback keeps one invariant: the filtered list is empty only when the raw list is empty, so the "no orgs, sign out" path and post-signup readiness gates behave exactly as before. The demo banner and "return to your workspace" machinery in Layout stays in place; it only activates in the demo-only fallback case, which is exactly when we still want it.
Scope / risk
Frontend only.
AGENTA_DEMOSseeding on the API is untouched; unsetting it on deployments stops new demo memberships but is a config change, not part of this PR. Users on an access allowlist whose only memberships are demo ones keep seeing the demo workspace (the fallback). One behavior change to know about: a user who has their own workspace can no longer enter a demo project via a direct/w/<demo>/p/<id>link, since the project is filtered from scope. That is consistent with hiding demo entirely.Tests
orgsDemoFilter.test.ts,projectsDemoFilter.test.ts): demo filtered out, kept when it is all the user has, empty in = empty out.projectAtom.race.test.tsstill passes (4/4);pickPreferredProjectis unchanged.pnpm lint-fixpasses;tscintroduces zero new errors against the baseline.How to QA
Prerequisites: a stack with demo seeding configured (
AGENTA_DEMOSset on the API) and an account that is a member of a demo org plus its own org.Steps:
Expected result: steps 1-2 show no demo org and no demo project anywhere. Step 3 still shows the demo workspace and the demo banner (the only-demo fallback).
Automated tests:
orgsDemoFilter.test.tsandprojectsDemoFilter.test.ts(pending vitest wiring in web/oss, see Tests).Edge cases: an account with a stale "last used project" pointing at the demo project should silently resolve to its own default project on next login.
https://claude.ai/code/session_01DjaJLpnLtnoRhgbYe7NTC3