diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-06-29 20:06:51 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-06-29 20:06:51 -0700 |
commit | 88e62aadc90a5e5b2be41eaaaf9d32632307316a (patch) | |
tree | 5229db1c2b1874eae16f5af481b32a5aeac00c98 /modern/src/map | |
parent | 125ca29a45bfbb4fd4ca950dfa6c1f5513739d56 (diff) | |
download | trackermap-web-88e62aadc90a5e5b2be41eaaaf9d32632307316a.tar.gz trackermap-web-88e62aadc90a5e5b2be41eaaaf9d32632307316a.tar.bz2 trackermap-web-88e62aadc90a5e5b2be41eaaaf9d32632307316a.zip |
Fix device removal
Diffstat (limited to 'modern/src/map')
-rw-r--r-- | modern/src/map/PositionsMap.js | 8 |
1 files changed, 4 insertions, 4 deletions
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', |