From 8f391131c550f9959489fb82f5b43f4730c64d62 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Thu, 24 Sep 2026 19:28:23 +0200 Subject: [PATCH] fix: send signed-out visitors on a shared chat link to the login page Opening a shared chat link while signed out landed on the home page with a blank screen. Only a manual refresh reached the login page, and after signing in the visitor ended up on the home page, so the link had to be opened again. This happened with every sign-in method, OAuth included. When the share could not be loaded, the share page navigated home twice. The second navigation cancelled the login redirect the first one had started, and since the app shell was already on screen, nothing checked the session again. The share page now navigates once. Signed-out visitors go to the login page with the share as the redirect target, so they land on the shared chat after signing in, OAuth included, since the login page keeps the target across the provider round trip. Signed-in users on a dead or forbidden link still go home, and open shares still render without signing in. Fixes #31334 --- src/routes/s/[id]/+page.svelte | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/routes/s/[id]/+page.svelte b/src/routes/s/[id]/+page.svelte index 4357e9c8f0..1b2fe59b31 100644 --- a/src/routes/s/[id]/+page.svelte +++ b/src/routes/s/[id]/+page.svelte @@ -52,8 +52,10 @@ if (await loadSharedChat()) { await tick(); loaded = true; - } else { + } else if (localStorage.token) { await goto('/'); + } else { + await goto(`/auth?redirect=${encodeURIComponent($page.url.pathname)}`); } })(); } @@ -102,10 +104,7 @@ : [] ); await chatId.set(shareId); - chat = await getChatByShareId(token, shareId).catch(async (error) => { - await goto('/'); - return null; - }); + chat = await getChatByShareId(token, shareId).catch(() => null); if (chat) { user = token