Update src/data/dhcp.ts

Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>
This commit is contained in:
J. Nick Koston 2025-04-17 08:25:14 -10:00 committed by GitHub
parent 5b962e226f
commit 329fc82fb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,14 +30,14 @@ const subscribeDHCPDiscoveryUpdates = (
(event) => {
const data = [...(store.state || [])];
if (event.add) {
for (const device_data of event.add) {
for (const deviceData of event.add) {
const index = data.findIndex(
(d) => d.mac_address === device_data.mac_address
(d) => d.mac_address === deviceData.mac_address
);
if (index === -1) {
data.push(device_data);
data.push(deviceData);
} else {
data[index] = device_data;
data[index] = deviceData;
}
}
}