File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ import type { Upload } from '@nextcloud/upload'
105105import type { UserConfig } from ' ../types.ts'
106106import type { View , ContentsWithRoot } from ' @nextcloud/files'
107107
108- import { emit } from ' @nextcloud/event-bus'
108+ import { emit , subscribe , unsubscribe } from ' @nextcloud/event-bus'
109109import { Folder , Node , Permission } from ' @nextcloud/files'
110110import { getCapabilities } from ' @nextcloud/capabilities'
111111import { 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' )
You can’t perform that action at this time.
0 commit comments