diff --git a/src/lib/components/layout/Sidebar/RecursiveFolder.svelte b/src/lib/components/layout/Sidebar/RecursiveFolder.svelte index 58cd428d0d..25d6fc51f9 100644 --- a/src/lib/components/layout/Sidebar/RecursiveFolder.svelte +++ b/src/lib/components/layout/Sidebar/RecursiveFolder.svelte @@ -528,7 +528,6 @@ let pendingUpsertChats = []; export const setFolderItems = async (append = false) => { - await tick(); if (open && chatsLoading) { if (!append) { queuedReload = true; @@ -536,11 +535,15 @@ return; } + if (open) { + chatsLoading = true; + } + + await tick(); if (open) { // Always use getSharedFolderChats so owners also see chats // created by users who have write access to this folder. const nextPage = append ? chatsPage + 1 : 1; - chatsLoading = true; try { const res = await getSharedFolderChats(localStorage.token, folderId, { page: nextPage @@ -584,7 +587,7 @@ } }; - $: if (open && chats === null) { + $: if (open && chats === null && !chatsLoading) { setFolderItems(); } @@ -888,7 +891,7 @@