@@ -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