-
Notifications
You must be signed in to change notification settings - Fork 60
Update preview when file is updated in ImageEditor #1554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,16 +25,17 @@ | |
| :mime="mime" | ||
| :src="src" | ||
| :fileid="fileid" | ||
| @updated="onUpdate" | ||
| @close="onClose" /> | ||
|
|
||
| <img v-else | ||
| <img v-else-if="data !== null" | ||
| :alt="alt" | ||
| :class="{ | ||
| dragging, | ||
| loaded, | ||
| zoomed: zoomRatio !== 1 | ||
| }" | ||
| :src="data" | ||
| :src="`${data}${cacheBuster}`" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| :style="{ | ||
| marginTop: shiftY + 'px', | ||
| marginLeft: shiftX + 'px', | ||
|
|
@@ -81,6 +82,8 @@ export default { | |
| shiftY: 0, | ||
| zoomRatio: 1, | ||
| fallback: false, | ||
| cacheBuster: '', | ||
| cacheBusterCounter: 0, | ||
| } | ||
| }, | ||
|
|
||
|
|
@@ -264,6 +267,10 @@ export default { | |
| this.fallback = true | ||
| } | ||
| }, | ||
|
|
||
| onUpdate() { | ||
| this.cacheBuster = `?buster=${this.cacheBusterCounter++}` | ||
| }, | ||
| }, | ||
| } | ||
| </script> | ||
|
|
||
There was a problem hiding this comment.
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
srcprop which seem to interfere withAsyncComputedlogic.The issue was that a request with
nullwas sent instead of waiting fordatato be initialized.