From 0e0c3a1bab4e579921c2a5c73f63655c01db44b2 Mon Sep 17 00:00:00 2001 From: Bilal Godil Date: Thu, 25 Jun 2026 13:11:08 -0700 Subject: [PATCH] Fix preview-mode logout when opening account settings In preview mode the dashboard uses an in-memory token store, so the hard reload from redirectToAccountSettings() wipes the session and bounces the user to a sign-in page. Soft-navigate via router.push (app.useNavigate) instead, which preserves the in-memory session. --- apps/dashboard/src/components/dashboard-user-button.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/dashboard/src/components/dashboard-user-button.tsx b/apps/dashboard/src/components/dashboard-user-button.tsx index 4cc6382c7..401684555 100644 --- a/apps/dashboard/src/components/dashboard-user-button.tsx +++ b/apps/dashboard/src/components/dashboard-user-button.tsx @@ -88,6 +88,9 @@ export function DashboardUserButton(props: DashboardUserButtonProps) { function DashboardUserButtonInner(props: DashboardUserButtonProps) { const user = useUser(); const app = useStackApp(); + // Soft-navigate: redirectToAccountSettings() hard-reloads, which wipes preview mode's + // in-memory session and bounces the user to sign-in. router.push keeps the session alive. + const navigate = app.useNavigate(); const showUserInfo = props.showUserInfo === true; const displayName = user?.displayName ?? user?.primaryEmail ?? "Account"; const iconProps = { size: 16, className: menuIconClassName }; @@ -142,7 +145,7 @@ function DashboardUserButtonInner(props: DashboardUserButtonProps) { {user && ( await app.redirectToAccountSettings()} + onClick={() => navigate("/handler/account-settings")} icon={} /> )}