From aa1dd240cddad340dd4c32a9ad805b4d2cb0e31c Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Fri, 16 Oct 2026 12:10:47 +0200 Subject: [PATCH] fix: message in a chat opened from the sidebar fails with "is not valid JSON" (#32534) Opening a chat from the sidebar while the home page was still setting up a new chat let that setup finish afterwards and clear the opened chat's id. The next message then failed with "Unexpected token 'd', "data: {"id"... is not valid JSON" and the chat's tags did not load. The new chat setup now stops once another chat has been opened. Signing in to an OAuth tool still turns it on together with the model's default tools. Follow-up to #32488 --- src/lib/components/chat/Chat.svelte | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index ee2a58bfab..224c92e777 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -2751,7 +2751,10 @@ // resetInput() must stay last: the selected model's defaults override the draft's selection. await restoreChatInput(sessionStorage.getItem('chat-input')); + const previousChatId = $chatId; await resetInput(); + // A chat opened in the meantime keeps its id + if ($chatId !== previousChatId) return; await chatId.set(''); await chatTitle.set('');