From a927d3ba78d8f2f630b85121f53067076af192b9 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Sat, 31 Oct 2026 11:26:37 +0100 Subject: [PATCH] fix: opening or reloading the new chat page shows no model and ignores URL parameters 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 d05c30a4dd..aad489688e 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -1929,6 +1929,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(); @@ -2461,8 +2465,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(); }