Skip to content

fix(web): let a user leave a workspace that needs payment - #414

Merged
setkyar merged 1 commit into
mainfrom
fix/workspace-chooser-escape
Oct 6, 2026
Merged

setkyar merged 1 commit into
mainfrom
fix/workspace-chooser-escape

Conversation

@setkyar

@setkyar setkyar commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Problem

After opening a workspace that needs payment, a user who belongs to other, healthy workspaces could not get back to them. Opening the workspace chooser (/workspaces) bounced straight back to the billing page: the chooser still fires the selected workspace's background requests (notifications, realtime token, sync status), and their 402s triggered the billing redirect.

Changes

lib/api/client.ts — the 402 billing redirect now skips two cases:

  • On the workspace chooser. It is the way out of a workspace that needs payment, so it never redirects back into billing.
  • A 402 for a workspace the user has already left. A request still in flight for the previous workspace no longer pulls the user back after they switch.

The second rule depends on WorkspaceRouteGuard no longer reverting a switch in flight (#413). Without that, a new workspace's 402 could arrive after a revert and be dropped.

lib/workspace-routes.ts — WORKSPACE_CHOOSER_PATH / isWorkspaceChooserPath.

Testing

  • client.test.ts: a 402 for the active workspace redirects with its id; a 402 for a workspace the user has left does not; nothing redirects from /workspaces. The last two fail before the change.
  • workspace-routes.test.ts: chooser path matching.
  • Full web suite (722 pass), bun run build, and biome are clean.

Opening the workspace chooser from a workspace that needs payment bounced
straight back to its billing page: the chooser still fires that workspace's
background requests, and their 402s triggered the billing redirect. The
chooser now never redirects to billing, and a 402 for a workspace the user
has already switched away from is ignored.

Ignoring stale 402s depends on WorkspaceRouteGuard no longer reverting a
switch in flight (#413); without that, a new workspace's 402 could arrive
after a revert and be dropped.
@setkyar
setkyar merged commit cf215c6 into main Oct 6, 2026
9 checks passed
@setkyar
setkyar deleted the fix/workspace-chooser-escape branch October 6, 2026 01:37
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