Fix theme updating entities card (#10979)

This commit is contained in:
Bram Kragten 2021-12-20 12:14:54 +01:00 committed by GitHub
parent 25ff5fef14
commit e2af8ac3cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -163,16 +163,16 @@ class HuiEntitiesCard extends LitElement implements LovelaceCard {
if (!this._config || !this._hass) { if (!this._config || !this._hass) {
return; return;
} }
const oldHass = changedProps.get("hass") as HomeAssistant | undefined; const oldHass = changedProps.get("_hass") as HomeAssistant | undefined;
const oldConfig = changedProps.get("_config") as const oldConfig = changedProps.get("_config") as
| EntitiesCardConfig | EntitiesCardConfig
| undefined; | undefined;
if ( if (
!oldHass || (changedProps.has("_hass") &&
!oldConfig || (!oldHass || oldHass.themes !== this._hass.themes)) ||
oldHass.themes !== this.hass.themes || (changedProps.has("_config") &&
oldConfig.theme !== this._config.theme (!oldConfig || oldConfig.theme !== this._config.theme))
) { ) {
applyThemesOnElement(this, this._hass.themes, this._config.theme); applyThemesOnElement(this, this._hass.themes, this._config.theme);
} }