diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/Sidebar.svelte index e9b2fccf20..72a0600749 100644 --- a/src/lib/components/layout/Sidebar.svelte +++ b/src/lib/components/layout/Sidebar.svelte @@ -1404,7 +1404,9 @@ {shiftKey} onFolderUnreadCounts={applyFolderUnreadCounts} onDelete={(folderId) => { - selectedFolder.set(null); + let id = $selectedFolder?.id; + while (id && id !== folderId) id = folders[id]?.parent_id; + if (id) selectedFolder.set(null); initChatList(); }} on:update={() => {