fix(settings): drop the settings return url when the workspace changed - #6847
Conversation
The settings Back button restores a return url captured on entry, but a workspace switch made from inside settings keeps the user in the new workspace without touching that stored path — so Back pushed them back into the workspace they had left, while the sidebar still read as the new one. Discard a stored return url that names a different workspace and fall back to the current workspace root.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview
Reviewed by Cursor Bugbot for commit 61f1966. Configure here. |
Greptile SummaryThe PR prevents the Settings Back action from returning users to a previously selected workspace.
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness or security issues identified. Legitimate settings return paths are normalized root-relative pathnames with stable workspace ID segments, and the new resolver correctly preserves or rejects them according to the active workspace.
|
| Filename | Overview |
|---|---|
| apps/sim/hooks/use-settings-navigation.ts | Adds workspace-aware validation when consuming the settings return URL; no actionable defect was identified. |
| apps/sim/hooks/use-settings-navigation.test.ts | Covers same-workspace, cross-workspace, workspace-agnostic, and absent stored return URLs. |
| apps/sim/hooks/use-oauth-return.ts | Replaces a duplicated storage-key literal with the exported settings-navigation constant. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Open settings] --> B[Store current pathname]
B --> C[Workspace may change]
C --> D[Click Back]
D --> E{Stored workspace matches current workspace?}
E -->|Yes or workspace-agnostic| F[Return to stored pathname]
E -->|No| G[Return to current workspace root]
Reviews (1): Last reviewed commit: "fix(settings): drop the settings return ..." | Re-trigger Greptile
Summary
resolveSettingsReturnUrlnow discards a stored return url that names a different workspace and falls back to the current workspace root. Workspace-agnostic paths (e.g./account/...) are kept.SETTINGS_RETURN_URL_KEY—use-oauth-returnredeclared the literal instead of importing it.Type of Change
Testing
Unit tests for
resolveSettingsReturnUrl(kept / discarded / workspace-agnostic / absent), verified to fail without the fix.bun run type-check,bun run lint, andbun run check:audits(29/29) clean.Checklist