summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2023-02-04 21:23:30 +0100
committerJohn Molakvoæ <skjnldsv@protonmail.com>2023-04-06 14:49:30 +0200
commit638b3dffa3de2c948b966e0575b9af85a3ed54d0 (patch)
tree96d303b018c285525cb7b66df53b4bc4c8ffb759
parent03c32774b060f48a900be5f9f943de84c298cca5 (diff)
downloadnextcloud-server-638b3dffa3de2c948b966e0575b9af85a3ed54d0.tar.gz
nextcloud-server-638b3dffa3de2c948b966e0575b9af85a3ed54d0.zip
perf(files): update files store by chunks
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
-rw-r--r--apps/files/src/store/files.ts12
1 files changed, 8 insertions, 4 deletions
diff --git a/apps/files/src/store/files.ts b/apps/files/src/store/files.ts
index c0ec1f7814b..96752653735 100644
--- a/apps/files/src/store/files.ts
+++ b/apps/files/src/store/files.ts
@@ -54,13 +54,17 @@ export const useFilesStore = defineStore('files', {
actions: {
updateNodes(nodes: Node[]) {
- nodes.forEach(node => {
+ // Update the store all at once
+ const files = nodes.reduce((acc, node) => {
if (!node.attributes.fileid) {
logger.warn('Trying to update/set a node without fileid', node)
- return
+ return acc
}
- Vue.set(this.files, node.attributes.fileid, node)
- })
+ acc[node.attributes.fileid] = node
+ return acc
+ }, {} as FilesStore)
+
+ Vue.set(this, 'files', {...this.files, ...files})
},
setRoot({ service, root }: RootOptions) {