From 423d2612af7db0fe4065a5c9d4c6521316e4c72d Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Wed, 25 Mar 2026 11:27:30 -0700 Subject: [PATCH] fix(auth): preserve active tab through login on bare domain The identity component's inline _getCurrentModule() assumed path-based routing (/{space}/{moduleId}) for non-subdomain URLs, returning "rspace" instead of the actual module. On bare domain (rspace.online/rnotes), this caused login to redirect to the canvas instead of rnotes. Add _isBareDomain() check so _getCurrentSpace() returns "demo" and _getCurrentModule() reads parts[0] (the module) on the bare domain. Co-Authored-By: Claude Opus 4.6 --- shared/components/rstack-identity.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/shared/components/rstack-identity.ts b/shared/components/rstack-identity.ts index 6953bb7..840caa3 100644 --- a/shared/components/rstack-identity.ts +++ b/shared/components/rstack-identity.ts @@ -323,13 +323,19 @@ function _isSubdomain(): boolean { const p = window.location.host.split(":")[0].split("."); return p.length >= 3 && p.slice(-2).join(".") === "rspace.online" && !_RESERVED.includes(p[0]); } +function _isBareDomain(): boolean { + const h = window.location.host.split(":")[0]; + return h === "rspace.online" || h === "www.rspace.online"; +} function _getCurrentSpace(): string { if (_isSubdomain()) return window.location.host.split(":")[0].split(".")[0]; + if (_isBareDomain()) return "demo"; return window.location.pathname.split("/").filter(Boolean)[0] || "demo"; } function _getCurrentModule(): string { const parts = window.location.pathname.split("/").filter(Boolean); - return _isSubdomain() ? (parts[0] || "rspace") : (parts[1] || "rspace"); + if (_isSubdomain() || _isBareDomain()) return parts[0] || "rspace"; + return parts[1] || "rspace"; } function _navUrl(space: string, moduleId: string): string { const h = window.location.host.split(":")[0].split(".");