From 17ed47744e202df37e850c9acad2de15377b3df6 Mon Sep 17 00:00:00 2001 From: Katrin Yordanova Date: Fri, 22 Dec 2023 17:42:54 +0200 Subject: [PATCH] Prevent map error in CMap when switching to another page --- lib/vue/src/components/map/CMap.vue | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/vue/src/components/map/CMap.vue b/lib/vue/src/components/map/CMap.vue index 93f0ab2bd..27788983e 100644 --- a/lib/vue/src/components/map/CMap.vue +++ b/lib/vue/src/components/map/CMap.vue @@ -282,13 +282,15 @@ export default { }, onBoundsUpdate (value) { - setTimeout(() => { - this.$refs.map.mapObject.invalidateSize() - }, 100) - - value = value || this.$refs.map.mapObject.getBounds() - - this.$emit('on-bounds-update', value) + if (this.$refs.map) { + setTimeout(() => { + this.$refs.map.mapObject.invalidateSize() + }, 100) + + value = value || this.$refs.map.mapObject.getBounds() + + this.$emit('on-bounds-update', value) + } } }, }