mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Fix duplicate id in energy-devices-detail-graph-card (#24261)
* Fix duplicate id in energy-devices-detail-graph-card * address compare * Update src/panels/lovelace/cards/energy/hui-energy-devices-detail-graph-card.ts Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com> * prettier --------- Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>
This commit is contained in:
parent
1434966170
commit
3ae34403bd
@ -448,7 +448,15 @@ export class HuiEnergyDevicesDetailGraphCard
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
return sorted_devices
|
return sorted_devices
|
||||||
.map((device) => data.find((d) => (d.id as string).includes(device))!)
|
.map(
|
||||||
|
(device) =>
|
||||||
|
data.find((d) => {
|
||||||
|
const id = (d.id as string)
|
||||||
|
.replace(/^compare-/, "") // Remove compare- prefix
|
||||||
|
.replace(/-\d+$/, ""); // Remove numeric suffix
|
||||||
|
return id === device;
|
||||||
|
})!
|
||||||
|
)
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user