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
This commit is contained in:
Classic298 2026-10-16 12:10:47 +02:00 • committed by GitHub
parent 51a4d58270
commit aa1dd240cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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('');