Skip to content

Commit

Permalink
fix: Reinit the files in File.vue
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <louis@chmn.me>
  • Loading branch information
artonge committed Jul 3, 2024
1 parent e2c848b commit a39c102
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/components/File.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,26 +146,19 @@ export default {
},
watch: {
file() {
async file() {
this.initialized = false
this.loadedSmall = false
this.errorSmall = false
this.loadedLarge = false
this.errorLarge = false
await this.init()
},
},
async mounted() {
[this.loadedSmall, this.loadedLarge] = await Promise.all([
await isCachedPreview(this.srcSmall),
await isCachedPreview(this.srcLarge),
])
this.initialized = true
await this.$nextTick() // Wait for next tick to have the canvas in the DOM
this.drawBlurhash()
await this.init()
},
beforeDestroy() {
Expand All @@ -179,6 +172,19 @@ export default {
},
methods: {
async init() {
[this.loadedSmall, this.loadedLarge] = await Promise.all([
await isCachedPreview(this.srcSmall),
await isCachedPreview(this.srcLarge),
])
this.initialized = true
await this.$nextTick() // Wait for next tick to have the canvas in the DOM
this.drawBlurhash()
},
emitClick() {
this.$emit('click', this.file.fileid)
},
Expand Down

0 comments on commit a39c102

Please sign in to comment.