refac
This commit is contained in:
1 parent
a40f6f2860
commit
736e38338e
2 files changed
+7
-3
No files matched your search
@@ -113,10 +113,10 @@
|
|||||||
folder={$selectedFolder}
|
folder={$selectedFolder}
|
||||||
readOnly={folderReadOnly}
|
readOnly={folderReadOnly}
|
||||||
onUpdate={async () => {
|
onUpdate={async () => {
|
||||||
await Promise.all([refreshChatList(localStorage.token), refreshFolderChatLists()]);
|
await Promise.all([refreshChatList(localStorage.token), refreshFolderChatLists(null)]);
|
||||||
}}
|
}}
|
||||||
onDelete={async () => {
|
onDelete={async () => {
|
||||||
await Promise.all([refreshChatList(localStorage.token), refreshFolderChatLists()]);
|
await Promise.all([refreshChatList(localStorage.token), refreshFolderChatLists(null)]);
|
||||||
|
|
||||||
selectedFolder.set(null);
|
selectedFolder.set(null);
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -702,6 +702,11 @@
|
|||||||
socketInstance?.on('connect', refreshChatRows);
|
socketInstance?.on('connect', refreshChatRows);
|
||||||
|
|
||||||
const unregisterFolderRefreshHandler = registerFolderRefreshHandler(async (folderId, chat) => {
|
const unregisterFolderRefreshHandler = registerFolderRefreshHandler(async (folderId, chat) => {
|
||||||
|
// null refreshes the folder tree; undefined refreshes all folder chat lists.
|
||||||
|
if (folderId === null) {
|
||||||
|
return initFolders();
|
||||||
|
}
|
||||||
|
|
||||||
if (folderId) {
|
if (folderId) {
|
||||||
if (chat) {
|
if (chat) {
|
||||||
return folderRegistry[folderId]?.upsertChat?.(chat);
|
return folderRegistry[folderId]?.upsertChat?.(chat);
|
||||||
@@ -710,7 +715,6 @@
|
|||||||
return folderRegistry[folderId]?.setFolderItems?.();
|
return folderRegistry[folderId]?.setFolderItems?.();
|
||||||
}
|
}
|
||||||
|
|
||||||
await initFolders();
|
|
||||||
return Promise.all(Object.values(folderRegistry).map((folder) => folder?.setFolderItems?.()));
|
return Promise.all(Object.values(folderRegistry).map((folder) => folder?.setFolderItems?.()));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user