mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +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
|
||||
.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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user