diff options
Diffstat (limited to 'apps/files/src')
-rw-r--r-- | apps/files/src/store/files.ts | 12 |
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) { |