Skip to content

Commit 39c5452

Browse files
marcelklehrAndyScherzinger
authored andcommitted
fix(files): Update sidebar when renaming node
fixes #51408 Signed-off-by: Marcel Klehr <mklehr@gmx.net>
1 parent 2609040 commit 39c5452

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

apps/files/src/views/Sidebar.vue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,14 @@ export default defineComponent({
325325
},
326326
created() {
327327
subscribe('files:node:deleted', this.onNodeDeleted)
328+
subscribe('files:node:updated', this.onNodeUpdated)
328329
329330
window.addEventListener('resize', this.handleWindowResize)
330331
this.handleWindowResize()
331332
},
332333
beforeDestroy() {
333334
unsubscribe('file:node:deleted', this.onNodeDeleted)
335+
unsubscribe('file:node:deleted', this.onNodeUpdated)
334336
window.removeEventListener('resize', this.handleWindowResize)
335337
},
336338
@@ -549,6 +551,17 @@ export default defineComponent({
549551
}
550552
},
551553
554+
/**
555+
* Handle if the current node was updated
556+
* @param {import('@nextcloud/files').Node} node The deleted node
557+
*/
558+
onNodeUpdated(node) {
559+
if (this.fileInfo && node && this.fileInfo.id === node.fileid) {
560+
this.close()
561+
this.open(node.path)
562+
}
563+
},
564+
552565
/**
553566
* Allow to set the Sidebar as fullscreen from OCA.Files.Sidebar
554567
*

0 commit comments

Comments
 (0)