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
Next Next commit
fix: Avoid issues when switching between versions
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr authored and backportbot-nextcloud[bot] committed Aug 10, 2023
commit f6da4c8e2ee51ae864354659e5147a9caf71aa84
27 changes: 24 additions & 3 deletions src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export default {

filters: {
uniqueKey(file) {
return file.fileid || file.source
return '' + file.fileid + file.source
},
},

Expand Down Expand Up @@ -397,6 +397,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 @@ -558,7 +579,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 @@ -609,7 +630,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