From 2b5dca2929892d80a30cbad62fbf0c9be46e416e Mon Sep 17 00:00:00 2001 From: silentoplayz Date: Sat, 27 Sep 2025 22:44:04 -0400 Subject: [PATCH] fix: pinned chats not updating after archiving all chats This commit fixes a UI bug where pinned chats would remain visible in the sidebar after all chats were archived from the Data Controls menu. The `archiveAllChatsHandler` in `DataControls.svelte` has been updated to clear the `pinnedChats` store, ensuring the sidebar UI is correctly updated. --- .../components/chat/Settings/DataControls.svelte | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/lib/components/chat/Settings/DataControls.svelte b/src/lib/components/chat/Settings/DataControls.svelte index 1ca5dd6da5..3aef3b1c62 100644 --- a/src/lib/components/chat/Settings/DataControls.svelte +++ b/src/lib/components/chat/Settings/DataControls.svelte @@ -2,14 +2,22 @@ import fileSaver from 'file-saver'; const { saveAs } = fileSaver; - import { chats, user, settings, scrollPaginationEnabled, currentChatPage } from '$lib/stores'; + import { + chats, + user, + settings, + scrollPaginationEnabled, + currentChatPage, + pinnedChats + } from '$lib/stores'; import { archiveAllChats, deleteAllChats, getAllChats, getChatList, - importChat + importChat, + getPinnedChatList } from '$lib/apis/chats'; import { getImportOrigin, convertOpenAIChats } from '$lib/utils'; import { onMount, getContext } from 'svelte'; @@ -74,6 +82,7 @@ currentChatPage.set(1); await chats.set(await getChatList(localStorage.token, $currentChatPage)); + pinnedChats.set(await getPinnedChatList(localStorage.token)); scrollPaginationEnabled.set(true); }; @@ -92,6 +101,7 @@ currentChatPage.set(1); await chats.set(await getChatList(localStorage.token, $currentChatPage)); + pinnedChats.set([]); scrollPaginationEnabled.set(true); };