Skip to content

Commit

Permalink
Refresh FileList on current folder update
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Ferreira <r.ferreira.fuentes@gmail.com>
  • Loading branch information
Raudius committed Jan 11, 2024
1 parent 286f2e0 commit b48181f
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion apps/files/src/views/FilesList.vue
Expand Up @@ -105,7 +105,7 @@ import type { Upload } from '@nextcloud/upload'
import type { UserConfig } from '../types.ts'
import type { View, ContentsWithRoot } from '@nextcloud/files'
import { emit } from '@nextcloud/event-bus'
import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
import { Folder, Node, Permission } from '@nextcloud/files'
import { getCapabilities } from '@nextcloud/capabilities'
import { join, dirname } from 'path'
Expand Down Expand Up @@ -406,6 +406,11 @@ export default defineComponent({
mounted() {
this.fetchContent()
subscribe('files:node:updated', this.onUpdatedNode)
},
unmounted() {
unsubscribe('files:node:updated', this.onUpdatedNode)
},
methods: {
Expand Down Expand Up @@ -493,6 +498,17 @@ export default defineComponent({
}
},
/**
* Refreshes the current folder on update.
*
* @param {Node} node is the file/folder being updated.
*/
onUpdatedNode(node) {
if (node?.fileid === this.currentFolder?.fileid) {
this.fetchContent()
}
},
openSharingSidebar() {
if (window?.OCA?.Files?.Sidebar?.setActiveTab) {
window.OCA.Files.Sidebar.setActiveTab('sharing')
Expand Down

0 comments on commit b48181f

Please sign in to comment.