From 63c6fcc94126d31945404ad3b4bb92bd4f558deb Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Thu, 16 Apr 2026 08:17:24 -0400 Subject: [PATCH] fix(auth): preserve current page on login instead of redirecting Only redirect to personal dashboard when on demo landing page. Logging in from any module page now reloads in place. Co-Authored-By: Claude Opus 4.6 --- shared/components/rstack-identity.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/shared/components/rstack-identity.ts b/shared/components/rstack-identity.ts index 0761e9ee..b465d53b 100644 --- a/shared/components/rstack-identity.ts +++ b/shared/components/rstack-identity.ts @@ -316,18 +316,18 @@ function autoResolveSpace(token: string, username: string): void { if (!username) return; const currentSpace = _getCurrentSpace(); + const currentModule = _getCurrentModule(); - if (currentSpace !== "demo") { - // User is on a specific space (their own or someone else's). - // Provision their personal space silently in the background. - // Don't redirect — they chose to be here. Just reload so the + if (currentSpace !== "demo" || currentModule !== "rspace") { + // User is viewing a specific page (their own space, someone else's, + // or a module on demo). Don't redirect — just reload so the // authenticated session takes effect (access gates, CRDT sync). autoProvisionSpace(token); window.location.reload(); return; } - // On demo/landing — provision personal space and redirect to dashboard + // On demo dashboard (landing page) — provision personal space and redirect fetch("/api/spaces/auto-provision", { method: "POST", headers: {