Repository navigation
fix(web): let a user leave a workspace that needs payment - #414
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:The second rule depends on
WorkspaceRouteGuardno 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.bun run build, and biome are clean.