diff options
author | skjnldsv <skjnldsv@protonmail.com> | 2025-07-04 20:25:53 +0200 |
---|---|---|
committer | skjnldsv <skjnldsv@protonmail.com> | 2025-07-08 09:13:51 +0200 |
commit | 2d4542072213d11396ec780d9b51b4060d031c8a (patch) | |
tree | 969396785fc06e928012a309a9e0508e75822bd8 | |
parent | 33a69bf985c5f8662fea008d5749dfa2a8eca4de (diff) | |
download | nextcloud-server-2d4542072213d11396ec780d9b51b4060d031c8a.tar.gz nextcloud-server-2d4542072213d11396ec780d9b51b4060d031c8a.zip |
fix(files): wait for nodes to be fetched before checking for opendetails or openfile
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
-rw-r--r-- | apps/files/src/components/FilesListVirtual.vue | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/apps/files/src/components/FilesListVirtual.vue b/apps/files/src/components/FilesListVirtual.vue index 156bc5fe161..9645b3fd42b 100644 --- a/apps/files/src/components/FilesListVirtual.vue +++ b/apps/files/src/components/FilesListVirtual.vue @@ -157,7 +157,6 @@ export default defineComponent({ FileEntry, FileEntryGrid, scrollToIndex: 0, - openFileId: null as number|null, } }, @@ -222,39 +221,37 @@ export default defineComponent({ isNoneSelected() { return this.selectedNodes.length === 0 }, + + isEmpty() { + return this.nodes.length === 0 + }, }, watch: { - fileId: { - handler(fileId) { - this.scrollToFile(fileId, false) - }, - immediate: true, - }, + // If nodes gets populated and we have a fileId, + // an openFile or openDetails, we fire the appropriate actions. + isEmpty(isEmpty: boolean) { + if (isEmpty || !this.fileId) { + return + } - openFile: { - handler(openFile) { - if (!openFile || !this.fileId) { - return - } + logger.debug('FilesListVirtual: nodes populated, checking for requested fileId, openFile or openDetails again', { + fileId: this.fileId, + openFile: this.openFile, + openDetails: this.openDetails, + }) + if (this.openFile) { this.handleOpenFile(this.fileId) - }, - immediate: true, - }, + } - openDetails: { - handler(openDetails) { - // wait for scrolling and updating the actions to settle - this.$nextTick(() => { - if (!openDetails || !this.fileId) { - return - } + if (this.openDetails) { + this.openSidebarForFile(this.fileId) + } - this.openSidebarForFile(this.fileId) - }) - }, - immediate: true, + if (this.fileId) { + this.scrollToFile(this.fileId, false) + } }, }, @@ -293,7 +290,7 @@ export default defineComponent({ sidebarAction.exec(node, this.currentView, this.currentFolder.path) return } - logger.error(`Failed to open sidebar on file ${fileId}, file isn't cached yet !`, { fileId, node }) + logger.warn(`Failed to open sidebar on file ${fileId}, file isn't cached yet !`, { fileId, node }) }, scrollToFile(fileId: number|null, warn = true) { |