Skip to content

Commit b48181f

Browse files
committed
Refresh FileList on current folder update
Signed-off-by: Raul Ferreira <[email protected]>
1 parent 286f2e0 commit b48181f

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

apps/files/src/views/FilesList.vue

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ import type { Upload } from '@nextcloud/upload'
105105
import type { UserConfig } from '../types.ts'
106106
import type { View, ContentsWithRoot } from '@nextcloud/files'
107107
108-
import { emit } from '@nextcloud/event-bus'
108+
import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
109109
import { Folder, Node, Permission } from '@nextcloud/files'
110110
import { getCapabilities } from '@nextcloud/capabilities'
111111
import { join, dirname } from 'path'
@@ -406,6 +406,11 @@ export default defineComponent({
406406
407407
mounted() {
408408
this.fetchContent()
409+
subscribe('files:node:updated', this.onUpdatedNode)
410+
},
411+
412+
unmounted() {
413+
unsubscribe('files:node:updated', this.onUpdatedNode)
409414
},
410415
411416
methods: {
@@ -493,6 +498,17 @@ export default defineComponent({
493498
}
494499
},
495500
501+
/**
502+
* Refreshes the current folder on update.
503+
*
504+
* @param {Node} node is the file/folder being updated.
505+
*/
506+
onUpdatedNode(node) {
507+
if (node?.fileid === this.currentFolder?.fileid) {
508+
this.fetchContent()
509+
}
510+
},
511+
496512
openSharingSidebar() {
497513
if (window?.OCA?.Files?.Sidebar?.setActiveTab) {
498514
window.OCA.Files.Sidebar.setActiveTab('sharing')

0 commit comments

Comments
 (0)