From fb8f8764aae3e509df75f5d3f25daf11a19a0029 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 18 Aug 2022 16:09:31 -0700 Subject: Fix geofence crash --- modern/src/map/MapGeofence.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modern/src/map/MapGeofence.js b/modern/src/map/MapGeofence.js index 31554f11..3bfbca24 100644 --- a/modern/src/map/MapGeofence.js +++ b/modern/src/map/MapGeofence.js @@ -80,11 +80,13 @@ const MapGeofence = () => { }, [mapGeofences]); useEffect(() => { - map.getSource(id).setData({ - type: 'FeatureCollection', - features: Object.values(geofences).map((geofence) => geofenceToFeature(theme, geofence)), - }); - }, [geofences]); + if (mapGeofences) { + map.getSource(id).setData({ + type: 'FeatureCollection', + features: Object.values(geofences).map((geofence) => geofenceToFeature(theme, geofence)), + }); + } + }, [mapGeofences, geofences]); return null; }; -- cgit v1.2.3