aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modern/src/map/PositionsMap.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/modern/src/map/PositionsMap.js b/modern/src/map/PositionsMap.js
index a953ce3..baa801f 100644
--- a/modern/src/map/PositionsMap.js
+++ b/modern/src/map/PositionsMap.js
@@ -27,11 +27,11 @@ const PositionsMap = ({ positions }) => {
};
const createFeature = (devices, position) => {
- const device = devices[position.deviceId] || null;
+ const device = devices[position.deviceId];
return {
deviceId: position.deviceId,
- name: device ? device.name : '',
- category: device && (device.category || 'default'),
+ name: device.name,
+ category: device.category || 'default',
color: deviceColor(device),
}
};
@@ -147,7 +147,7 @@ const PositionsMap = ({ positions }) => {
useEffect(() => {
map.getSource(id).setData({
type: 'FeatureCollection',
- features: positions.map(position => ({
+ features: positions.filter(it => devices.hasOwnProperty(it.deviceId)).map(position => ({
type: 'Feature',
geometry: {
type: 'Point',