From 1dacddba8996846b473bab9dfdf11c4a230d2a2c Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Wed, 11 Nov 2026 02:10:05 +0100 Subject: [PATCH] fix: Temporary Chat is lost on a page reload after opening Notes or a folder (#34072) The Temporary Chat button puts `?temporary-chat=true` into the address of a new chat, and a page reload reads it there. Before the first message was sent the address lost it (after switching to the Notes tab and back to the chat tab, after opening a folder or after a reload while a folder is open) while the Temporary Chat label still showed, so the next reload opened a normal chat and a message sent then was saved. While a new chat is the active tab, its address now carries `?temporary-chat=true` whenever Temporary Chat is on (also when it was turned on by the keyboard shortcut, by Temporary Chat by Default or by enforced temporary chats) and no longer carries it when Temporary Chat is off. An existing quirk remains: reload a temporary new chat, turn Temporary Chat off and send a message, then start a new chat from the chat header on a small screen or delete or archive that chat, and the new chat is temporary again. This now also happens when the reloaded chat was made temporary with the keyboard shortcut and, from the chat header only, with Temporary Chat by Default. --- src/lib/components/chat/Tabs.svelte | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/components/chat/Tabs.svelte b/src/lib/components/chat/Tabs.svelte index bb5a07ff46..ab4f98df49 100644 --- a/src/lib/components/chat/Tabs.svelte +++ b/src/lib/components/chat/Tabs.svelte @@ -1543,6 +1543,11 @@ : active?.kind === 'side' ? (active.chatId ? `/c/${active.chatId}` : active.href) : null; if (href) { const url = new URL(href, location.origin); + if (active?.kind === 'chat' && !chatId) { + // delete() re-encodes the other parameters even when it removes nothing. + if ($temporaryChatEnabled) url.searchParams.set('temporary-chat', 'true'); + else if (url.searchParams.has('temporary-chat')) url.searchParams.delete('temporary-chat'); + } if (url.origin === location.origin && url.href !== location.href) { // Reflect selection without routing through SvelteKit and remounting the workspace. window.history.replaceState(window.history.state, '', url);