Skip to content

Commit

Permalink
fix: Avoid issues when switching between versions
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliushaertl committed Aug 10, 2023
1 parent ffd1c24 commit db3c220
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
1 change: 0 additions & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@
<dependencies>
<nextcloud min-version="28" max-version="28" />
</dependencies>
<default_enable />
</info>
27 changes: 24 additions & 3 deletions src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export default {
filters: {
uniqueKey(file) {
return file.fileid || file.source
return '' + file.fileid + file.source
},
},
Expand Down Expand Up @@ -402,6 +402,27 @@ export default {
'viewer--split': this.comparisonFile,
}
},
isSameFile() {
return (fileInfo = null, path = null) => {
if (
path && path === this.currentFile.path
&& !this.currentFile.source
) {
return true
}
if (
fileInfo && fileInfo.fileid === this.currentFile.fileid
&& fileInfo.mtime && fileInfo.mtime === this.currentFile.mtime
&& fileInfo.source && fileInfo.source === this.currentFile.source
) {
return true
}
return false
}
},
},
watch: {
Expand Down Expand Up @@ -563,7 +584,7 @@ export default {
this.cancelRequestFile()
// do not open the same file again
if (path === this.currentFile.path && !this.currentFile.source) {
if (this.isSameFile(null, path)) {
return
}
Expand Down Expand Up @@ -614,7 +635,7 @@ export default {
this.cancelRequestFolder()
// do not open the same file info again
if (fileInfo.basename === this.currentFile.basename && fileInfo.source !== this.currentFile.source) {
if (this.isSameFile(fileInfo)) {
return
}
Expand Down

0 comments on commit db3c220

Please sign in to comment.