From a0caa1f21d3c5d2c587f4304d4ec36522e7514a5 Mon Sep 17 00:00:00 2001 From: Till JS Date: Tue, 31 Mar 2026 19:02:04 +0200 Subject: [PATCH] fix(manacore-web): fix login redirect flow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Root +page.svelte: use authStore instead of data.session (always undefined) → after email verification auto-sign-in, redirects to /home not /login - (auth)/+layout.svelte: remove racing $effect, keep only onMount redirect check → no more double goto() race condition after login - login/+page.svelte: successRedirect /dashboard → /home (consistent with root) Co-Authored-By: Claude Sonnet 4.6 --- .../apps/web/src/routes/(auth)/+layout.svelte | 14 ++------------ .../apps/web/src/routes/(auth)/login/+page.svelte | 2 +- apps/manacore/apps/web/src/routes/+page.svelte | 13 +++++++------ 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/apps/manacore/apps/web/src/routes/(auth)/+layout.svelte b/apps/manacore/apps/web/src/routes/(auth)/+layout.svelte index 3c06c9adb..87fa3096b 100644 --- a/apps/manacore/apps/web/src/routes/(auth)/+layout.svelte +++ b/apps/manacore/apps/web/src/routes/(auth)/+layout.svelte @@ -8,21 +8,11 @@ let { children }: { children: Snippet } = $props(); let isDark = $derived(theme.isDark); - let hasCheckedAuth = $state(false); - - // Check auth status on mount + // If user is already authenticated when visiting auth pages, redirect to home onMount(async () => { await authStore.initialize(); - hasCheckedAuth = true; if (authStore.isAuthenticated) { - goto('/dashboard'); - } - }); - - // Also react to auth state changes (e.g., after successful login) - $effect(() => { - if (hasCheckedAuth && authStore.isAuthenticated) { - goto('/dashboard'); + goto('/home'); } }); diff --git a/apps/manacore/apps/web/src/routes/(auth)/login/+page.svelte b/apps/manacore/apps/web/src/routes/(auth)/login/+page.svelte index c4966c658..c7debd0f3 100644 --- a/apps/manacore/apps/web/src/routes/(auth)/login/+page.svelte +++ b/apps/manacore/apps/web/src/routes/(auth)/login/+page.svelte @@ -38,7 +38,7 @@ onVerifyBackupCode={(code) => authStore.verifyBackupCode(code)} onSendMagicLink={(email) => authStore.sendMagicLink(email)} {goto} - successRedirect="/dashboard" + successRedirect="/home" registerPath="/register" forgotPasswordPath="/forgot-password" lightBackground="#f3f4f6" diff --git a/apps/manacore/apps/web/src/routes/+page.svelte b/apps/manacore/apps/web/src/routes/+page.svelte index 108a8419c..e8f17437d 100644 --- a/apps/manacore/apps/web/src/routes/+page.svelte +++ b/apps/manacore/apps/web/src/routes/+page.svelte @@ -1,13 +1,14 @@