Skip to content

fix(frontend): keep workspace settings on the workspace in the URL - #174

Merged
stefan-ernst merged 2 commits into
Windshiftapp:mainfrom
fmaass:fix/workspace-route-fallback
Aug 9, 2026
Merged

fix(frontend): keep workspace settings on the workspace in the URL#174
stefan-ernst merged 2 commits into
Windshiftapp:mainfrom
fmaass:fix/workspace-route-fallback

Conversation

@fmaass

@fmaass fmaass commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Problem

Opening one workspace's settings and then navigating to another workspace's settings leaves the page showing the first workspace. MainApp renders a single WorkspaceSettings instance for every /workspaces/:id/settings/* view, but the component loaded its workspace only in onMount. After such a switch the form still holds the previous workspace's name, key, description and — on the Danger tab — its "Active Workspace" toggle and delete confirmation, while saveWorkspace() and deleteWorkspace() already address the new id from the URL: saving writes one workspace's settings onto another, and the delete confirmation is validated against the old workspace's name while deleting the new one.

Fix

  • The workspace load now follows the workspaceId prop (the same $effect + load-key pattern WorkspaceWelcome uses), with a load-version guard so a superseded response cannot repopulate the form.
  • Workspace, form, and delete-confirmation state are cleared on every switch, so an unloadable workspace falls through to the existing "Workspace not found" state instead of silently showing a different workspace.
  • MainApp clears stale currentWorkspace context as soon as the route changes, then hydrates it from the routed workspace response.
  • Save and delete completions are fenced the same way: both pin their target workspace before awaiting, so what the server actually changed is still applied to the workspace list wherever the user has moved to, while view-scoped effects only run while that workspace is still on screen.
  • The delayed post-delete redirect rechecks the active route and is cancelled when the component is destroyed.

Verification

  • Manual: open workspace A's settings, then navigate in-app to workspace B's settings. Before: the form still shows A. After: the form, the Danger tab and the sidebar identity all follow the URL. With a throttled network, a superseded response for A can no longer overwrite B's form, and an in-flight delete of A no longer redirects away from B.
  • npm run check, npm run typecheck, and npm run build pass.
  • The overlaid frontend test suite passes with regression coverage in test: begin API v2 fixture and contract migration core-tests#1.

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

MainApp renders a single WorkspaceSettings instance for every
/workspaces/:id/settings/* view, so moving between two workspaces'
settings changes the workspaceId prop under a mounted component. The
component loaded its workspace only in onMount, so after such a switch
the page kept rendering the previously opened workspace: its name, key,
description and — on the danger tab — its "Active Workspace" toggle and
delete confirmation, while saveWorkspace() and deleteWorkspace() already
addressed the new id from the URL. Saving wrote one workspace's settings
onto another, and the delete confirmation was validated against the old
workspace's name while deleting the new one.

Load from the workspaceId prop instead of from the mount, with a load
version guard so a superseded response cannot repopulate the form, and
clear workspace/form/delete-confirmation state on every switch. A
workspace that cannot be loaded now falls through to the existing
"Workspace not found" branch instead of showing another workspace.

Fence the save and delete completions the same way: both pin their target
id (and the payload / the confirmed name) before awaiting. What the server
actually changed is applied unconditionally — the workspace list must drop
a deleted workspace and pick up a renamed one wherever the user has moved
to — while the view-scoped effects (form state, currentWorkspace, the
toast, the redirect off the deleted workspace) only run while that target
is still the one on screen.

For the same reason, MainApp no longer leaves the previously hydrated
workspace in currentWorkspace when the routed one fails to load: the
shell (workspace header, avatar, gradient, command-palette scope) must
not present a different workspace than the URL names.
@fmaass
fmaass force-pushed the fix/workspace-route-fallback branch from 0398176 to c7096be Compare August 9, 2026 10:49
@fmaass

fmaass commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@fmaass

fmaass commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

recheck

@fmaass

fmaass commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Heads-up for maintainers: the failing cla check appears to be on the workflow side rather than the signature — the run errors with Branch cla-signatures not found before it can record anything (see run 31310298157). cla.yml points path-to-signatures at branch: cla-signatures, which does not exist in this repo yet, so I suspect every external contributor will hit the same failure. My sign-comment is posted above; once the branch exists, a recheck should record it and flip the check.

@stefan-ernst

Copy link
Copy Markdown
Contributor

Thank you for the contribution @fmaass - I will have a look at this PR + the cla issue

@stefan-ernst

Copy link
Copy Markdown
Contributor

recheck

github-actions Bot added a commit that referenced this pull request Aug 9, 2026
@stefan-ernst

Copy link
Copy Markdown
Contributor

ok now I signed the cla but it does not matter :)
thanks again for the contribution, merging now

@stefan-ernst
stefan-ernst merged commit ea8638f into Windshiftapp:main Aug 9, 2026
2 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.

2 participants