mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Fix chart tooltip crash for disabled entity (#17767)
This commit is contained in:
parent
e98e59a265
commit
3917739ad2
@ -108,7 +108,7 @@ export const formatNumber = (
|
|||||||
* @returns An `Intl.NumberFormatOptions` object with `maximumFractionDigits` set to 0, or `undefined`
|
* @returns An `Intl.NumberFormatOptions` object with `maximumFractionDigits` set to 0, or `undefined`
|
||||||
*/
|
*/
|
||||||
export const getNumberFormatOptions = (
|
export const getNumberFormatOptions = (
|
||||||
entityState: HassEntity,
|
entityState?: HassEntity,
|
||||||
entity?: EntityRegistryDisplayEntry
|
entity?: EntityRegistryDisplayEntry
|
||||||
): Intl.NumberFormatOptions | undefined => {
|
): Intl.NumberFormatOptions | undefined => {
|
||||||
const precision = entity?.display_precision;
|
const precision = entity?.display_precision;
|
||||||
@ -119,8 +119,8 @@ export const getNumberFormatOptions = (
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
Number.isInteger(Number(entityState.attributes?.step)) &&
|
Number.isInteger(Number(entityState?.attributes?.step)) &&
|
||||||
Number.isInteger(Number(entityState.state))
|
Number.isInteger(Number(entityState?.state))
|
||||||
) {
|
) {
|
||||||
return { maximumFractionDigits: 0 };
|
return { maximumFractionDigits: 0 };
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user