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 hassChanged = changedProperties.has("hass");
const oldHass = changedProperties.get("hass") as this["hass"] | undefined;
const configChanged = changedProperties.has("config");
if (changedProperties.has("config")) {
if (configChanged) {
this._createCard();
} else if (hassChanged) {
(this.lastChild! as LovelaceCard).hass = this.hass;
}
if (
hassChanged &&
oldHass &&
(hass.themes !== oldHass.themes ||
hass.selectedTheme !== oldHass.selectedTheme)
configChanged ||
(hassChanged &&
oldHass &&
(hass.themes !== oldHass.themes ||
hass.selectedTheme !== oldHass.selectedTheme))
) {
applyThemesOnElement(this, hass.themes, this.config!.theme);
}