aboutsummaryrefslogtreecommitdiff
path: root/modern/src
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src')
-rw-r--r--modern/src/map/MapPositions.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/modern/src/map/MapPositions.js b/modern/src/map/MapPositions.js
index 68073fab..600a6373 100644
--- a/modern/src/map/MapPositions.js
+++ b/modern/src/map/MapPositions.js
@@ -172,6 +172,10 @@ const MapPositions = ({ positions, onClick, showStatus, selectedPosition, titleF
map.off('click', clusters, onClusterClick);
map.off('click', onMapClick);
+ if (map.getLayer(clusters)) {
+ map.removeLayer(clusters);
+ }
+
[id, selected].forEach((id) => {
if (map.getLayer(id)) {
map.removeLayer(id);
@@ -179,13 +183,10 @@ const MapPositions = ({ positions, onClick, showStatus, selectedPosition, titleF
if (map.getLayer(`direction-${id}`)) {
map.removeLayer(`direction-${id}`);
}
+ if (map.getSource(id)) {
+ map.removeSource(id);
+ }
});
- if (map.getLayer(clusters)) {
- map.removeLayer(clusters);
- }
- if (map.getSource(id)) {
- map.removeSource(id);
- }
};
}, [mapCluster, clusters, onMarkerClick, onClusterClick]);