Fix picture header footer upgrade (#5945)

This commit is contained in:
Bram Kragten 2020-05-20 17:34:15 +02:00 committed by GitHub
parent 28d26065e4
commit dcd6c6f06f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import {
LitElement,
property,
TemplateResult,
PropertyValues,
} from "lit-element";
import { classMap } from "lit-html/directives/class-map";
import { ifDefined } from "lit-html/directives/if-defined";
@ -30,7 +31,7 @@ export class HuiPictureHeaderFooter extends LitElement
};
}
public hass?: HomeAssistant;
@property() public hass?: HomeAssistant;
@property() protected _config?: PictureHeaderFooterConfig;
@ -42,6 +43,13 @@ export class HuiPictureHeaderFooter extends LitElement
this._config = config;
}
protected shouldUpdate(changedProps: PropertyValues): boolean {
if (changedProps.size === 1 && changedProps.has("hass")) {
return !changedProps.get("hass");
}
return true;
}
protected render(): TemplateResult {
if (!this._config || !this.hass) {
return html``;