Fix set theme on panel (#3749)

This commit is contained in:
Bram Kragten 2019-09-18 14:12:54 +02:00 committed by GitHub
parent fca885a17a
commit 31ae115062
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,18 +28,20 @@ export class HUIPanelView extends UpdatingElement {
const hass = this.hass!; const hass = this.hass!;
const hassChanged = changedProperties.has("hass"); const hassChanged = changedProperties.has("hass");
const oldHass = changedProperties.get("hass") as this["hass"] | undefined; const oldHass = changedProperties.get("hass") as this["hass"] | undefined;
const configChanged = changedProperties.has("config");
if (changedProperties.has("config")) { if (configChanged) {
this._createCard(); this._createCard();
} else if (hassChanged) { } else if (hassChanged) {
(this.lastChild! as LovelaceCard).hass = this.hass; (this.lastChild! as LovelaceCard).hass = this.hass;
} }
if ( if (
hassChanged && configChanged ||
oldHass && (hassChanged &&
(hass.themes !== oldHass.themes || oldHass &&
hass.selectedTheme !== oldHass.selectedTheme) (hass.themes !== oldHass.themes ||
hass.selectedTheme !== oldHass.selectedTheme))
) { ) {
applyThemesOnElement(this, hass.themes, this.config!.theme); applyThemesOnElement(this, hass.themes, this.config!.theme);
} }