diff --git a/server/landing.ts b/server/landing.ts index 0046f41..96574a1 100644 --- a/server/landing.ts +++ b/server/landing.ts @@ -339,6 +339,20 @@ export function renderSpaceDashboard(space: string, modules: ModuleInfo[]): stri import '/shell.js'; document.querySelector('rstack-app-switcher')?.setModules(${moduleListJSON}); + // Logged-in users: redirect to rSpace canvas instead of showing the grid + try { + var raw = localStorage.getItem('encryptid_session'); + if (raw) { + var session = JSON.parse(raw); + if (session?.accessToken) { + var dest = window.__rspaceNavUrl + ? window.__rspaceNavUrl('${escapeAttr(space)}', 'rspace') + : '/${escapeAttr(space)}/rspace'; + window.location.replace(dest); + } + } + } catch(e) {} + // Fix up dashboard links to be subdomain-aware if (window.__rspaceNavUrl) { document.querySelectorAll('.sd-card[data-module]').forEach(card => { diff --git a/shared/components/rstack-identity.ts b/shared/components/rstack-identity.ts index bf2c630..26c3c2f 100644 --- a/shared/components/rstack-identity.ts +++ b/shared/components/rstack-identity.ts @@ -401,6 +401,8 @@ export class RStackIdentity extends HTMLElement { this.#render(); if (e.key === "encryptid_session") { this.dispatchEvent(new CustomEvent("auth-change", { bubbles: true, composed: true })); + // Session cleared from another tab — reload to show logged-out state + if (!e.newValue) window.location.reload(); } } }; @@ -534,8 +536,10 @@ export class RStackIdentity extends HTMLElement { if (action === "signout") { clearSession(); resetDocBridge(); - this.#render(); this.dispatchEvent(new CustomEvent("auth-change", { bubbles: true, composed: true })); + // Reload so the server re-renders the current rApp in logged-out mode + window.location.reload(); + return; } else if (action === "my-account") { this.showAccountModal(); } else if (action === "my-spaces") {