mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-01 17:32:52 -05:00
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.
This commit is contained in:
1 parent
a5ee2942f1
commit
1dacddba89
1 file changed
+5
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user