From 7449de0a8ba8dc580e0da4f7f618da6e0bf2894b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Maria=20Mezzopera?= Date: Wed, 24 Jul 2019 09:54:18 +0200 Subject: [PATCH] feat: destroy map on beforeDestroy to prevent memory leak --- src/components/LMap.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/LMap.vue b/src/components/LMap.vue index 21b8bbde..97cfd431 100644 --- a/src/components/LMap.vue +++ b/src/components/LMap.vue @@ -131,6 +131,11 @@ export default { return options; } }, + beforeDestroy () { + if (this.mapObject) { + this.mapObject.remove(); + } + }, mounted () { const options = optionsMerger({ minZoom: this.minZoom,