Skip to content

Commit

Permalink
Fix geofence crash
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Aug 18, 2022
1 parent aa72fc6 commit fb8f876
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions modern/src/map/MapGeofence.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down

0 comments on commit fb8f876

Please sign in to comment.