diff options
author | Pytal <24800714+Pytal@users.noreply.github.com> | 2024-08-10 05:59:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-10 05:59:44 -0700 |
commit | 4a512d408d66ff5d580d564d9d34419b4bcbdf8c (patch) | |
tree | eee66c542968e0f0958e3595779c2b34768acbbb /apps/files | |
parent | d50b6da868ff4f98d6ee809ae265523c9b8f0edd (diff) | |
parent | d0186fe5cadeb8ce7206ca0e164789b565dd483a (diff) | |
download | nextcloud-server-4a512d408d66ff5d580d564d9d34419b4bcbdf8c.tar.gz nextcloud-server-4a512d408d66ff5d580d564d9d34419b4bcbdf8c.zip |
Merge pull request #47157 from nextcloud/perf/prevent-extra-requests
perf(files): Prevent extraneous requests when tree children are loading
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/src/views/folderTree.ts | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/apps/files/src/views/folderTree.ts b/apps/files/src/views/folderTree.ts index 4ae07c0d79b..4224012cd5b 100644 --- a/apps/files/src/views/folderTree.ts +++ b/apps/files/src/views/folderTree.ts @@ -31,6 +31,7 @@ const isFolderTreeEnabled = loadState('files', 'config', { folder_tree: true }). const Navigation = getNavigation() const queue = new PQueue({ concurrency: 5, intervalCap: 5, interval: 200 }) + const registerQueue = new PQueue({ concurrency: 5, intervalCap: 5, interval: 200 }) const registerTreeNodes = async (path: string = '/') => { @@ -44,16 +45,12 @@ const registerTreeNodes = async (path: string = '/') => { const getLoadChildViews = (node: TreeNode | Folder) => { return async (view: View): Promise<void> => { // @ts-expect-error Custom property on View instance - if (view.loaded) { + if (view.loading || view.loaded) { return } // @ts-expect-error Custom property view.loading = true - try { - await registerTreeNodes(node.path) - } catch (error) { - // Skip duplicate view registration errors - } + await registerTreeNodes(node.path) // @ts-expect-error Custom property view.loading = false // @ts-expect-error Custom property |