From eb582e6c808e65acac8ce4f118fc8ec78877be70 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 25 Mar 2022 10:59:45 +0000 Subject: [PATCH] Fix bug which prevented last marker being removed from the map if deleted --- .../src/components/app/embedded-map/EmbeddedMap.svelte | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/client/src/components/app/embedded-map/EmbeddedMap.svelte b/packages/client/src/components/app/embedded-map/EmbeddedMap.svelte index a6803ef5dd..7738a0d345 100644 --- a/packages/client/src/components/app/embedded-map/EmbeddedMap.svelte +++ b/packages/client/src/components/app/embedded-map/EmbeddedMap.svelte @@ -231,11 +231,15 @@ titleKey, onClick ) => { - if (!mapInstance || !validRows?.length) { + if (!mapInstance) { return } mapMarkerGroup.clearLayers() + if (!validRows?.length) { + return + } + validRows.forEach(row => { let markerCoords = [row[latKey], row[lngKey]] let marker = L.marker(markerCoords, mapMarkerOptions).addTo(mapInstance)