Skip to content

Commit

Permalink
fix: Reset File state on file update
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <louis@chmn.me>
  • Loading branch information
artonge committed Mar 7, 2024
1 parent 12f6e25 commit 27e7570
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/components/File.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ export default {
data() {
return {
initialized: false,
isDestroyed: false,
loadedSmall: false,
errorSmall: false,
loadedLarge: false,
Expand Down Expand Up @@ -163,6 +162,16 @@ export default {
},
},
watch: {
file() {
this.initialized = false
this.loadedSmall = false
this.errorSmall = false
this.loadedLarge = false
this.errorLarge = false
},
},
async mounted() {
[this.loadedSmall, this.loadedLarge] = await Promise.all([
await isCachedPreview(this.srcSmall),
Expand All @@ -177,8 +186,6 @@ export default {
},
beforeDestroy() {
this.isDestroyed = true
// cancel any pending load
if (this.$refs.imgSmall !== undefined) {
this.$refs.imgSmall.src = ''
Expand Down

0 comments on commit 27e7570

Please sign in to comment.