diff --git a/client/src/Map/Device/DeviceMarkersShown.jsx b/client/src/Map/Device/DeviceMarkersShown.jsx index aa44d67..47375fc 100644 --- a/client/src/Map/Device/DeviceMarkersShown.jsx +++ b/client/src/Map/Device/DeviceMarkersShown.jsx @@ -46,18 +46,18 @@ export const DeviceMarkersShown = ({ showDeviceNames }) => { { - const added = []; + const newSelection = [...selection]; for (const { deviceItemName, deviceTypeName, location } of shownDevices) { if (boxZoomBounds.contains(location.coordinates)) { - const isSelected = selection.find(s => { + const isSelected = newSelection.find(s => { return s.deviceItemName === deviceItemName && s.deviceTypeName === deviceTypeName }); if (!isSelected) { - added.push({ deviceItemName, deviceTypeName }); + newSelection.push({ deviceItemName, deviceTypeName }); } } } - setSelection([...selection, ...added]); + setSelection(newSelection); }} />