From 082df44d92178b6895153774bf6656c538cbce40 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Tue, 3 Nov 2026 02:29:02 +0100 Subject: [PATCH] fix: opening or reloading the new chat page shows no model and ignores URL parameters (#33459) Opening or reloading the new chat page or a folder's page showed "Select a model" in place of the default model, ignored URL parameters such as models=, model= and q= (which fills in the message), and a message sent from there got no reply. Now the default model or the one from the URL is selected and the URL parameters apply, whether you open the page directly or come from another chat. Opening the Inbox and coming back still keeps the typed message and the chosen model. Fixes #33457 --- src/lib/components/chat/Chat.svelte | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 20b13b781b..fe01dd781f 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -1962,6 +1962,10 @@ }); } + if ($page.url.pathname === '/' || $page.url.pathname.startsWith('/folders/')) { + tick().then(initNewChat); + } + // the artifacts pane reads this list when it opens, which can be before the debounced rebuild const showArtifactsSubscribe = showArtifacts.subscribe((value) => { if (value) getContents(); @@ -2494,8 +2498,12 @@ return () => bridge?.end(); }); // Only real navigation resets the chat; shallow sidebar state changes must preserve it. - afterNavigate(async ({ to }) => { - if (to?.url.pathname === '/' || to?.url.pathname.startsWith('/folders/')) { + afterNavigate(async ({ from, to }) => { + // A navigation that mounts this page starts its new chat in onMount. + if ( + from?.route.id === to?.route.id && + (to?.url.pathname === '/' || to?.url.pathname.startsWith('/folders/')) + ) { await tick(); initNewChat(); }