diff options
Diffstat (limited to 'modern/src')
-rw-r--r-- | modern/src/map/MapGeofence.js | 12 |
1 files 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; }; |