Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions js/viewer-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer-main.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/components/ImageEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ export default {
if (putUrl !== this.src) {
emit('files:file:created', { fileid: parseInt(response?.headers?.['oc-fileid']?.split('oc')[0]) || null })
} else {
this.$emit('updated')
emit('files:file:updated', { fileid: this.fileid })
}
} catch (error) {
Expand Down
11 changes: 9 additions & 2 deletions src/components/Images.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,17 @@
:mime="mime"
:src="src"
:fileid="fileid"
@updated="onUpdate"
@close="onClose" />

<img v-else
<img v-else-if="data !== null"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed as we are using a concatenation for the src prop which seem to interfere with AsyncComputed logic.
The issue was that a request with null was sent instead of waiting for data to be initialized.

:alt="alt"
:class="{
dragging,
loaded,
zoomed: zoomRatio !== 1
}"
:src="data"
:src="`${data}${cacheBuster}`"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple approach, but it works. Sexier idea welcome. :)

This makes sure that the initial request can use the browser's cache, and that on an update the cache is busted with ?buster=1

:style="{
marginTop: shiftY + 'px',
marginLeft: shiftX + 'px',
Expand Down Expand Up @@ -81,6 +82,8 @@ export default {
shiftY: 0,
zoomRatio: 1,
fallback: false,
cacheBuster: '',
cacheBusterCounter: 0,
}
},

Expand Down Expand Up @@ -264,6 +267,10 @@ export default {
this.fallback = true
}
},

onUpdate() {
this.cacheBuster = `?buster=${this.cacheBusterCounter++}`
},
},
}
</script>
Expand Down