diff options
author | Anton Tananaev <anton@traccar.org> | 2022-08-18 16:09:31 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-08-18 16:09:31 -0700 |
commit | fb8f8764aae3e509df75f5d3f25daf11a19a0029 (patch) | |
tree | 36a15e08b5b48acf53089284dc6e8d3419bf46b4 /modern/src/map/MapGeofence.js | |
parent | aa72fc6dbe2be7e3322a8a6110a6997435a0679a (diff) | |
download | trackermap-web-fb8f8764aae3e509df75f5d3f25daf11a19a0029.tar.gz trackermap-web-fb8f8764aae3e509df75f5d3f25daf11a19a0029.tar.bz2 trackermap-web-fb8f8764aae3e509df75f5d3f25daf11a19a0029.zip |
Fix geofence crash
Diffstat (limited to 'modern/src/map/MapGeofence.js')
-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; }; |