Skip to content

Commit 3a07e99

Browse files
Merge pull request #2816 from nextcloud/perf/loading-order
2 parents dbe93ea + 3f7370f commit 3a07e99

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

  • apps/viewer/apps/viewer/apps/viewer/src/views

apps/viewer/apps/viewer/apps/viewer/src/views/Viewer.vue

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,10 @@ export default defineComponent({
693693
this.lightBackdrop = handler.theme === 'light' || (handler.theme === 'default' && defaultThemeIsLight)
694694
this.handlerId = handler.id
695695
696+
this.currentFile = new File(fileInfo, mime, handler.component)
697+
this.comparisonFile = null
698+
this.updatePreviousNext()
699+
696700
// check if part of a group, if so retrieve full files list
697701
const group = this.mimeGroups[mime]
698702
if (this.files && this.files.length > 0) {
@@ -711,6 +715,10 @@ export default defineComponent({
711715
const { request: folderRequest, cancel: cancelRequestFolder } = cancelableRequest(getFileList)
712716
this.cancelRequestFolder = cancelRequestFolder
713717
const [dirPath] = extractFilePaths(fileInfo.filename)
718+
719+
this.currentIndex = 0
720+
this.fileList = [fileInfo]
721+
714722
const fileList = await folderRequest(dirPath)
715723
716724
// filter out the unwanted mimes
@@ -723,19 +731,12 @@ export default defineComponent({
723731
724732
// store current position
725733
this.currentIndex = this.fileList.findIndex(file => file.filename === fileInfo.filename)
734+
this.updatePreviousNext()
726735
} else {
727736
this.currentIndex = 0
728737
this.fileList = [fileInfo]
729738
}
730739
731-
// get saved fileInfo
732-
fileInfo = this.fileList[this.currentIndex] ?? fileInfo
733-
734-
// show file
735-
this.currentFile = new File(fileInfo, mime, handler.component)
736-
this.comparisonFile = null
737-
this.updatePreviousNext()
738-
739740
// if sidebar was opened before, let's update the file
740741
this.changeSidebar()
741742
},

0 commit comments

Comments
 (0)