From 2b9e30a10779d60e9f6ae892984ee640713f46ff Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sun, 13 Jul 2025 03:43:30 +0400 Subject: [PATCH] refac --- src/lib/components/chat/Chat.svelte | 7 ++++--- src/lib/components/layout/Sidebar.svelte | 6 ++++++ src/lib/components/layout/Sidebar/ChatItem.svelte | 6 +++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 6d0b31e85d..c700658ca8 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -1990,7 +1990,6 @@ history: history, messages: createMessagesList(history, history.currentId), tags: [], - timestamp: Date.now() }, $selectedFolder?.id @@ -1999,10 +1998,12 @@ _chatId = chat.id; await chatId.set(_chatId); + window.history.replaceState(history.state, '', `/c/${_chatId}`); + + await tick(); + await chats.set(await getChatList(localStorage.token, $currentChatPage)); currentChatPage.set(1); - - window.history.replaceState(history.state, '', `/c/${_chatId}`); } else { _chatId = 'local'; await chatId.set('local'); diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/Sidebar.svelte index 0a853aa546..40f69f660c 100644 --- a/src/lib/components/layout/Sidebar.svelte +++ b/src/lib/components/layout/Sidebar.svelte @@ -362,6 +362,12 @@ } }); + chats.subscribe((value) => { + if ($selectedFolder) { + initFolders(); + } + }); + await initChannels(); await initChatList(); diff --git a/src/lib/components/layout/Sidebar/ChatItem.svelte b/src/lib/components/layout/Sidebar/ChatItem.svelte index 9362c16105..2a43911221 100644 --- a/src/lib/components/layout/Sidebar/ChatItem.svelte +++ b/src/lib/components/layout/Sidebar/ChatItem.svelte @@ -301,7 +301,7 @@