From aea9334f06fe43875261dfa891e51a98bce11a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C5=BEe=20Fortun?= Date: Wed, 19 Apr 2023 12:50:47 +0200 Subject: [PATCH] Fix blocks overlapping in rare cases when coming from a page with a single block --- client/web/compose/src/components/Common/Grid.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/client/web/compose/src/components/Common/Grid.vue b/client/web/compose/src/components/Common/Grid.vue index 77f10f675..d5080a99a 100644 --- a/client/web/compose/src/components/Common/Grid.vue +++ b/client/web/compose/src/components/Common/Grid.vue @@ -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 } + }) }) }, },