diff options
Diffstat (limited to 'modern/src/map/PositionsMap.js')
-rw-r--r-- | modern/src/map/PositionsMap.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/modern/src/map/PositionsMap.js b/modern/src/map/PositionsMap.js index 9719b45b..8d100534 100644 --- a/modern/src/map/PositionsMap.js +++ b/modern/src/map/PositionsMap.js @@ -148,9 +148,15 @@ const PositionsMap = ({ positions }) => { map.off('click', id, onMarkerClick); map.off('click', clusters, onClusterClick); - map.removeLayer(id); - map.removeLayer(clusters); - map.removeSource(id); + if (map.getLayer(id)) { + map.removeLayer(id); + } + if (map.getLayer(clusters)) { + map.removeLayer(clusters); + } + if (map.getSource(id)) { + map.removeSource(id); + } }; }, [onMarkerClick]); |