Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Commit

Permalink
Fix elements not rendering when switching between reports
Browse files Browse the repository at this point in the history
  • Loading branch information
Fajfa committed Mar 2, 2022
1 parent ca3ffe7 commit 24d163a
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/components/Report/Blocks/index.vue
Expand Up @@ -120,8 +120,14 @@ export default {
},
watch: {
'block.elements.length': {
'block.blockID': {
immediate: true,
handler () {
this.renderBlock()
},
},
'block.elements.length': {
handler (length, oldLength) {
if (length) {
const defaultSize = Math.floor(100 / length)
Expand All @@ -133,20 +139,27 @@ export default {
e.meta.size = !addedOrRemoved && e.meta.size ? e.meta.size : defaultSize
return e
})
this.runReport()
// Hack around split not rerendering
this.showDisplayElements = false
this.$nextTick().then(() => {
this.showDisplayElements = true
})
}
this.renderBlock()
},
},
},
methods: {
renderBlock () {
const { elements = [] } = this.block || {}
if (elements.length) {
this.runReport()
// Hack around split not rerendering
this.showDisplayElements = false
this.$nextTick().then(() => {
this.showDisplayElements = true
})
}
},
setDisplayElementSizes (sizes = []) {
sizes.forEach((size, index) => {
this.block.elements[index].meta.size = size
Expand Down

0 comments on commit 24d163a

Please sign in to comment.