perf: load sidebar folders alongside the chat list (#35242)

The sidebar only started loading folders after the chat list had arrived, so on every app load and chat list refresh the folders showed up one network round trip later than needed. The two requests do not depend on each other and now run at the same time, so the folder tree also refreshes when a newer chat list refresh replaces the current one.
This commit is contained in:
Classic298 authored and GitHub committed 2026-11-30 23:02:22 +04:00
1 parent e4ef437a8a
commit ad372cd0e7
1 file changed
+4 -2
+4 -2
View File
@@ -745,9 +745,11 @@
const refreshChatRows = async () => {
markFolderChatsDirty();
const result = await refreshChatList(localStorage.token, { refreshPinned: true });
const [result] = await Promise.all([
refreshChatList(localStorage.token, { refreshPinned: true }),
initFolders()
]);
if (result.accepted) {
await initFolders();
await Promise.all(Object.values(folderRegistry).map((folder) => folder?.setFolderItems?.()));
chatListReady = true;
}