aboutsummaryrefslogtreecommitdiff
path: root/modern
diff options
context:
space:
mode:
Diffstat (limited to 'modern')
-rw-r--r--modern/src/map/MapGeofence.js2
-rw-r--r--modern/src/map/MapMarkers.js4
-rw-r--r--modern/src/map/MapPositions.js4
-rw-r--r--modern/src/map/MapRoutePath.js2
-rw-r--r--modern/src/map/MapRoutePoints.js4
-rw-r--r--modern/src/map/main/MapAccuracy.js5
-rw-r--r--modern/src/map/main/MapLiveRoutes.js2
7 files changed, 11 insertions, 12 deletions
diff --git a/modern/src/map/MapGeofence.js b/modern/src/map/MapGeofence.js
index 6208795c..73b32724 100644
--- a/modern/src/map/MapGeofence.js
+++ b/modern/src/map/MapGeofence.js
@@ -81,7 +81,7 @@ const MapGeofence = () => {
useEffect(() => {
if (mapGeofences) {
- map.getSource(id).setData({
+ map.getSource(id)?.setData({
type: 'FeatureCollection',
features: Object.values(geofences).map((geofence) => geofenceToFeature(theme, geofence)),
});
diff --git a/modern/src/map/MapMarkers.js b/modern/src/map/MapMarkers.js
index 8bcfd8d6..8fbe92b6 100644
--- a/modern/src/map/MapMarkers.js
+++ b/modern/src/map/MapMarkers.js
@@ -67,7 +67,7 @@ const MapMarkers = ({ markers, showTitles }) => {
}, [showTitles]);
useEffect(() => {
- map.getSource(id).setData({
+ map.getSource(id)?.setData({
type: 'FeatureCollection',
features: markers.map(({ latitude, longitude, image, title }) => ({
type: 'Feature',
@@ -81,7 +81,7 @@ const MapMarkers = ({ markers, showTitles }) => {
},
})),
});
- }, [markers]);
+ }, [showTitles, markers]);
return null;
};
diff --git a/modern/src/map/MapPositions.js b/modern/src/map/MapPositions.js
index 5bff23fb..49639e8d 100644
--- a/modern/src/map/MapPositions.js
+++ b/modern/src/map/MapPositions.js
@@ -178,7 +178,7 @@ const MapPositions = ({ positions, onClick, showStatus, selectedPosition, titleF
}, [mapCluster, clusters, direction, onMarkerClick, onClusterClick]);
useEffect(() => {
- map.getSource(id).setData({
+ map.getSource(id)?.setData({
type: 'FeatureCollection',
features: positions.filter((it) => devices.hasOwnProperty(it.deviceId)).map((position) => ({
type: 'Feature',
@@ -189,7 +189,7 @@ const MapPositions = ({ positions, onClick, showStatus, selectedPosition, titleF
properties: createFeature(devices, position, selectedPosition && selectedPosition.id),
})),
});
- }, [devices, positions, selectedPosition]);
+ }, [mapCluster, clusters, direction, onMarkerClick, onClusterClick, devices, positions, selectedPosition]);
return null;
};
diff --git a/modern/src/map/MapRoutePath.js b/modern/src/map/MapRoutePath.js
index 8b9e0468..c7d03400 100644
--- a/modern/src/map/MapRoutePath.js
+++ b/modern/src/map/MapRoutePath.js
@@ -81,7 +81,7 @@ const MapRoutePath = ({ name, positions, coordinates }) => {
if (!coordinates) {
coordinates = positions.map((item) => [item.longitude, item.latitude]);
}
- map.getSource(id).setData({
+ map.getSource(id)?.setData({
type: 'Feature',
geometry: {
type: 'LineString',
diff --git a/modern/src/map/MapRoutePoints.js b/modern/src/map/MapRoutePoints.js
index 38a0e226..bed81f3a 100644
--- a/modern/src/map/MapRoutePoints.js
+++ b/modern/src/map/MapRoutePoints.js
@@ -55,7 +55,7 @@ const MapPositions = ({ positions, onClick }) => {
}, [onMarkerClick]);
useEffect(() => {
- map.getSource(id).setData({
+ map.getSource(id)?.setData({
type: 'FeatureCollection',
features: positions.map((position, index) => ({
type: 'Feature',
@@ -69,7 +69,7 @@ const MapPositions = ({ positions, onClick }) => {
},
})),
});
- }, [positions]);
+ }, [onMarkerClick, positions]);
return null;
};
diff --git a/modern/src/map/main/MapAccuracy.js b/modern/src/map/main/MapAccuracy.js
index 335be58e..cdc706cc 100644
--- a/modern/src/map/main/MapAccuracy.js
+++ b/modern/src/map/main/MapAccuracy.js
@@ -42,13 +42,12 @@ const MapAccuracy = ({ positions }) => {
}, []);
useEffect(() => {
- const data = {
+ map.getSource(id)?.setData({
type: 'FeatureCollection',
features: positions
.filter((position) => position.accuracy > 0)
.map((position) => circle([position.longitude, position.latitude], position.accuracy * 0.001)),
- };
- map.getSource(id).setData(data);
+ });
}, [positions]);
return null;
diff --git a/modern/src/map/main/MapLiveRoutes.js b/modern/src/map/main/MapLiveRoutes.js
index 397d8c52..049ff9c9 100644
--- a/modern/src/map/main/MapLiveRoutes.js
+++ b/modern/src/map/main/MapLiveRoutes.js
@@ -61,7 +61,7 @@ const MapLiveRoutes = () => {
.filter((id) => (type === 'selected' ? id === selectedDeviceId : true))
.filter((id) => history.hasOwnProperty(id));
- map.getSource(id).setData({
+ map.getSource(id)?.setData({
type: 'FeatureCollection',
features: deviceIds.map((deviceId) => ({
type: 'Feature',