ソースを参照

enh: open folder on drop

Timothy J. Baek 6 ヶ月 前
コミット
b402061546

+ 5 - 2
src/lib/components/layout/Sidebar.svelte

@@ -617,8 +617,8 @@
 										});
 
 										if (res) {
-											await initFolders();
 											initChatList();
+											await initFolders();
 										}
 									}
 
@@ -628,6 +628,7 @@
 										if (res) {
 											await pinnedChats.set(await getPinnedChatList(localStorage.token));
 											initChatList();
+											await initFolders();
 										}
 									}
 								}
@@ -679,6 +680,7 @@
 					<Folders
 						{folders}
 						on:update={async (e) => {
+							initChatList();
 							await initFolders();
 						}}
 					/>
@@ -705,8 +707,8 @@
 									);
 
 									if (res) {
-										await initFolders();
 										initChatList();
+										await initFolders();
 									}
 								}
 
@@ -716,6 +718,7 @@
 									if (res) {
 										await pinnedChats.set(await getPinnedChatList(localStorage.token));
 										initChatList();
+										await initFolders();
 									}
 								}
 							}

+ 4 - 1
src/lib/components/layout/Sidebar/RecursiveFolder.svelte

@@ -20,7 +20,7 @@
 	import { updateChatFolderIdById } from '$lib/apis/chats';
 	import ChatItem from './ChatItem.svelte';
 
-	export let open = true;
+	export let open = false;
 
 	export let folders;
 	export let folderId;
@@ -66,6 +66,7 @@
 				const { type, id } = data;
 
 				if (type === 'folder') {
+					open = true;
 					if (id === folderId) {
 						return;
 					}
@@ -81,6 +82,8 @@
 						dispatch('update');
 					}
 				} else if (type === 'chat') {
+					open = true;
+
 					// Move the chat
 					const res = await updateChatFolderIdById(localStorage.token, id, folderId).catch(
 						(error) => {