From 88e62aadc90a5e5b2be41eaaaf9d32632307316a Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 29 Jun 2021 20:06:51 -0700 Subject: Fix device removal --- modern/src/map/PositionsMap.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'modern/src') diff --git a/modern/src/map/PositionsMap.js b/modern/src/map/PositionsMap.js index a953ce3d..baa801fb 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', -- cgit v1.2.3