Fix blocks overlapping in rare cases when coming from a page with a single block

This commit is contained in:
Jože Fortun
2023-04-19 12:50:47 +02:00
parent 8fa7e047cb
commit aea9334f06
@@ -120,9 +120,14 @@ export default {
immediate: true,
deep: true,
handler (blocks) {
this.layout = blocks.map(({ meta, xywh: [x, y, w, h] }, i) => {
// To avoid collision with hidden elements
return meta.hidden ? { i, x: 0, y: 0, w: 0, h: 0 } : { i, x, y, w, h }
this.layout = []
// Next tick is important, otherwise it can lead to overlapping blocks
this.$nextTick(() => {
this.layout = blocks.map(({ meta, xywh: [x, y, w, h] }, i) => {
// To avoid collision with hidden elements
return meta.hidden ? { i, x: 0, y: 0, w: 0, h: 0 } : { i, x, y, w, h }
})
})
},
},