Fix devices graph max_devices (#25406)

pull/25409/head
karwosts 2025-05-09 09:35:54 -07:00 committed by GitHub
parent 8fc55cb6e2
commit 8a0d3baf67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -244,7 +244,10 @@ export class HuiEnergyDevicesGraphCard
chartData.sort((a: any, b: any) => b.value[0] - a.value[0]);
chartData.length = this._config?.max_devices || chartData.length;
chartData.length = Math.min(
this._config?.max_devices || Infinity,
chartData.length
);
this._chartData = datasets;
await this.updateComplete;