Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(files): wait for nodes to be fetched before checking for opendeta…
…ils or openfile

Signed-off-by: skjnldsv <[email protected]>
  • Loading branch information
skjnldsv committed Jul 8, 2025
commit 2d4542072213d11396ec780d9b51b4060d031c8a
51 changes: 24 additions & 27 deletions apps/files/src/components/FilesListVirtual.vue
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ export default defineComponent({
FileEntry,
FileEntryGrid,
scrollToIndex: 0,
openFileId: null as number|null,
}
},

Expand Down Expand Up @@ -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)
}
},
},

Expand Down Expand Up @@ -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) {
Expand Down