mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
update hasChanged for formatEntityState, fix glance card shouldUpdate (#17854)
This commit is contained in:
parent
4a6539d75b
commit
7176a51fec
@ -35,6 +35,7 @@ import { createEntityNotFoundWarning } from "../components/hui-warning";
|
||||
import "../components/hui-warning-element";
|
||||
import { LovelaceCard, LovelaceCardEditor } from "../types";
|
||||
import { GlanceCardConfig, GlanceConfigEntity } from "./types";
|
||||
import { hasConfigOrEntitiesChanged } from "../common/has-changed";
|
||||
|
||||
@customElement("hui-glance-card")
|
||||
export class HuiGlanceCard extends LitElement implements LovelaceCard {
|
||||
@ -121,28 +122,7 @@ export class HuiGlanceCard extends LitElement implements LovelaceCard {
|
||||
}
|
||||
|
||||
protected shouldUpdate(changedProps: PropertyValues): boolean {
|
||||
if (changedProps.has("_config")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const oldHass = changedProps.get("hass") as HomeAssistant | undefined;
|
||||
|
||||
if (
|
||||
!this._configEntities ||
|
||||
!oldHass ||
|
||||
oldHass.themes !== this.hass!.themes ||
|
||||
oldHass.locale !== this.hass!.locale
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (const entity of this._configEntities) {
|
||||
if (oldHass.states[entity.entity] !== this.hass!.states[entity.entity]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return hasConfigOrEntitiesChanged(this, changedProps);
|
||||
}
|
||||
|
||||
protected render() {
|
||||
|
@ -22,6 +22,11 @@ export function hasConfigChanged(
|
||||
oldHass.themes !== element.hass!.themes ||
|
||||
oldHass.locale !== element.hass!.locale ||
|
||||
oldHass.localize !== element.hass.localize ||
|
||||
oldHass.formatEntityState !== element.hass.formatEntityState ||
|
||||
oldHass.formatEntityAttributeName !==
|
||||
element.hass.formatEntityAttributeName ||
|
||||
oldHass.formatEntityAttributeValue !==
|
||||
element.hass.formatEntityAttributeValue ||
|
||||
oldHass.config.state !== element.hass.config.state
|
||||
) {
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user