Skip to content

fix(settings): drop the settings return url when the workspace changed - #6847

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/back-nav-workspace-switch
Aug 19, 2026
Merged

fix(settings): drop the settings return url when the workspace changed#6847
waleedlatif1 merged 1 commit into
stagingfrom
fix/back-nav-workspace-switch

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Settings stores the page you came from and the Back button restores it, but switching workspaces from inside settings keeps you in the new workspace without touching that stored path — so Back pushed you back into the workspace you left, while the sidebar still read as the new one.
  • resolveSettingsReturnUrl now 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.
  • Validating on read rather than clearing on switch also covers restored sessions, a second tab that switched, and any future entry point into settings.
  • De-duplicated SETTINGS_RETURN_URL_KEYuse-oauth-return redeclared the literal instead of importing it.

Type of Change

  • Bug fix

Testing

Unit tests for resolveSettingsReturnUrl (kept / discarded / workspace-agnostic / absent), verified to fail without the fix. bun run type-check, bun run lint, and bun run check:audits (29/29) clean.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

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.
@vercel

vercel Bot commented Aug 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 19, 2026 5:07pm

Request Review

@cursor

cursor Bot commented Aug 19, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Client-only settings navigation and sessionStorage return-url handling; no auth, billing, or data-path changes.

Overview
Fixes Back from settings sending users into a workspace they left when they had switched workspaces while still in settings—the sidebar showed the new workspace but the stored return path still pointed at the old one.

resolveSettingsReturnUrl now runs when popping the sessionStorage return URL: it keeps paths for the current workspace and workspace-agnostic routes (e.g. /account/...), and otherwise falls back to the workspace root. Validation on read also covers restored sessions and other tabs without clearing storage on every switch.

SETTINGS_RETURN_URL_KEY is exported from use-settings-navigation and reused in use-oauth-return instead of a duplicate literal.

Reviewed by Cursor Bugbot for commit 61f1966. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR prevents the Settings Back action from returning users to a previously selected workspace.

  • Adds workspace-aware validation of the stored settings return URL.
  • Preserves workspace-agnostic and same-workspace destinations while falling back to the current workspace root for stale destinations.
  • Reuses the settings return URL key in OAuth return handling and adds focused unit coverage.

Confidence Score: 5/5

The 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.

Important Files Changed

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]
Loading

Reviews (1): Last reviewed commit: "fix(settings): drop the settings return ..." | Re-trigger Greptile

@waleedlatif1
waleedlatif1 merged commit dafa4da into staging Aug 19, 2026
30 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/back-nav-workspace-switch branch August 19, 2026 17:15
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