Skip to content

Commit

Permalink
fix double selection
Browse files Browse the repository at this point in the history
  • Loading branch information
erasta committed Dec 24, 2024
1 parent f8a6771 commit 25b2791
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client/src/Map/Device/DeviceMarkersShown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ export const DeviceMarkersShown = ({ showDeviceNames }) => {
</PopupSwitchProvider>
<AreaMarkListener
onAreaMarked={({ boxZoomBounds }) => {
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);
}}
/>
</>
Expand Down

0 comments on commit 25b2791

Please sign in to comment.