From dceadf9db084a08b48817eff8a1d7b899542fb61 Mon Sep 17 00:00:00 2001 From: G30 <50341825+silentoplayz@users.noreply.github.com> Date: Fri, 13 Nov 2026 03:38:08 -0500 Subject: [PATCH] fix: cancelling "Discard unsaved changes?" no longer leaves the main chat blank (#34300) --- src/lib/components/chat/Chat.svelte | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 9f7b57056f..0d235ddf4c 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -16,7 +16,7 @@ const i18n: Writable = getContext('i18n'); const appLayout = getContext('appLayout'); - import { goto, beforeNavigate, afterNavigate } from '$app/navigation'; + import { goto, beforeNavigate, afterNavigate, onNavigate } from '$app/navigation'; import { page } from '$app/stores'; import { get, writable, type Unsubscriber, type Writable } from 'svelte/store'; @@ -2740,11 +2740,13 @@ } stopAudio(); }); - beforeNavigate(({ from, to }) => { - if (!embedded && to && from?.url.pathname !== to.url.pathname) loading = true; + beforeNavigate(() => { bridge?.end(); pendingUrlActions = null; }); + onNavigate(({ from, to }) => { + if (!embedded && to && from?.url.pathname !== to.url.pathname) loading = true; + }); $: if (!$user && (bridge?.connected || bridge?.connecting)) bridge.end(); $: if (selectedModelIds && $models && $config) bridge?.syncModel();