Repository navigation
Description
Summary
After you switch organization from any dashboard page, the browser's Back button can't take you back. Every Back press returns to /dashboard/switching?to=‹new org›&subpath=…, which runs the switch again and lands on the same page in the new organization. Back is trapped there; history doesn't even grow.
The switch route means to replace its history entry, but its subpath branch pushes:
// services/platform/app/routes/dashboard/switching.tsx:126–141 (main d29a3c8fe)
// Replace history entry so Back button doesn't return here. …
router.history.push(`/dashboard/${targetOrgId}/${targetSubpath}`, {
replace: true,
});TanStack History's signature is push(path, state?, navigateOpts?) (@tanstack/history 1.161.6, index.d.ts:19), so { replace: true } is stored as history state and the entry is pushed. The branch without a subpath uses navigate({ …, replace: true }), which replaces correctly.
The org switchers enter this route with replace: true (organization-list-panel.tsx:49–53), so the page you switched from is gone from history. The switching URL stays in its place, under the new page.
Source and environment
- Source:
origin/maind29a3c8fe78cdba54d247fe82ea5195f702c0651(2026-10-04), in a detached worktree with no local changes. - Stack: an isolated local stack started with
bun scripts/dev.ts.- Vite runs on
localhost:3751and the backend on127.0.0.1:3756. - The occurrence has its own PostgreSQL on
127.0.0.1:55379, and egress goes to a dead proxy.
- Vite runs on
- Owner: TALE-358 local-qa occurrence 2026-10-04 08:15 Zurich, run
01879aef-d562-4abd-b5b5-2b3bdf431a89. - Browser: headless Chromium 1208 (Playwright 1.58.2) at 1280×900,
en-US. - Data: one synthetic owner of two organizations, A and B, each with one project.
- Origin of the lead: first seen while reading code during TALE-540's evidence run (noted to TALE-359 as
1de47518); reproduced here.
Reproduction (the real journey)
- In organization A, open Chat, then Projects (
/dashboard/‹A›/projects). - Open Manage account › Organization and choose organization B.
- Navigations:
/dashboard/switching?to=‹B›&subpath=projects, then/dashboard/‹B›/projects. history.lengthgoes from 3 to 4.
- Navigations:
- Press Back three times.
| Step | Observed URL after Back | Navigations that Back caused | history.length |
|---|---|---|---|
| Back 1 | /dashboard/‹B›/projects |
switching?to=‹B›&subpath=projects → /dashboard/‹B›/projects |
4 |
| Back 2 | /dashboard/‹B›/projects |
the same two | 4 |
| Back 3 | /dashboard/‹B›/projects |
the same two | 4 |
Each Back also flashes the "Switching to …" spinner and calls setActive again.
Controls
| Case | After the switch | Back 1 |
|---|---|---|
No subpath (/dashboard/switching?to=‹B›, the navigate({ replace: true }) branch), loaded from A's Chat |
/dashboard/‹B›/chat |
/dashboard/‹A›/chat: Back works |
With a subpath (…&subpath=projects), the same entry |
/dashboard/‹B›/projects |
/dashboard/‹B›/projects again: trapped |
One-line swap in the worktree, router.history.replace(path), then the real journey |
/dashboard/‹B›/projects, history.length 3 |
/dashboard/‹A›/chat; Back 2 reaches the start of history |
| The same swap, with a subpath | /dashboard/‹B›/projects |
/dashboard/‹A›/chat |
The swap was reverted afterwards, and the worktree is clean.
Impact
- Who's affected: anyone in more than one organization who switches from the user menu or Settings › Your organizations. That's nearly every switch, because the menu carries the current page as
subpath. - What they can't do: go back with Back. Each press re-runs the switch to the organization they just left for, flashes a spinner and writes the active organization again.
- The only ways out: typing a URL, or the long-press history menu.
- Same branch, other callers: any switch with a subpath, including links that land on
/dashboard/switching?to=…&subpath=….
Expected
Leaving through the switch replaces the switching entry, as the code comment says. Back after a switch then returns to the page before the one you switched from, as the no-subpath branch already does.
Acceptance checks
- Back escapes: after a user-menu switch from a page with a subpath, Back leaves organization B and doesn't revisit
/dashboard/switching. - The entry is replaced:
/dashboard/switching?…never remains in history after a switch, with or without a subpath (history.lengthdoesn't grow by the switch entry). - A test pins replace semantics on both branches, for example a router-history spy asserting
replace(notpush) for the subpath path, or a browser test of Back.
Evidence and limits
- Evidence kept locally (TALE-358
r20261004T0815):- the probe
scripts/b1-org-switch-back.ts; evidence/b1-org-switch-back-main.logand…-swapped.log;evidence/b1-swap.diff;- screenshots in
evidence/b1-main/andb1-swapped/.
- the probe
- Limits:
- Desktop Chromium only. The phone layout's switcher wasn't driven.
- After Back to A's URL, the session's active organization stayed B for a few seconds, then followed the URL. That is the existing route guard and is not part of this report.
Activity
yannickmonney commentedon Oct 9, 2026
Post-merge recheck (Review A, 2026-10-10 00:15 Europe/Zurich)
Static recheck at main
e6fb96249, after #4410 merged at 2026-10-09T22:19:58Z (f31bc4021):routes/dashboard/switching.tsxnow callsrouter.history.replace(…)throughreplaceDashboardPath. Acceptance checks 1 and 2 are met in source; the no-subpath branch already usednavigate({ …, replace: true }).switching.test.tsxcallsreplaceDashboardPathdirectly with a stub history. Reverting the route tohistory.push(…, { replace: true })would not fail it, and the no-subpath branch isn't pinned. A route-level history spy, or a browser test of Back, would pin the behaviour.