Guard for undefined hass (#7647)

This commit is contained in:
Bram Kragten 2020-11-11 13:55:45 +01:00 committed by GitHub
parent 3186d762f2
commit e84bef44b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View File

@ -13,7 +13,7 @@ import { HomeAssistant } from "../types";
@customElement("ha-icon-button-arrow-next")
export class HaIconButtonArrowNext extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property({ attribute: false }) public hass?: HomeAssistant;
@property({ type: Boolean }) public disabled = false;
@ -36,7 +36,7 @@ export class HaIconButtonArrowNext extends LitElement {
protected render(): TemplateResult {
return html`<mwc-icon-button
.disabled=${this.disabled}
.label=${this.label || this.hass.localize("ui.common.next")}
.label=${this.label || this.hass?.localize("ui.common.next") || "Next"}
>
<ha-svg-icon .path=${this._icon}></ha-svg-icon>
</mwc-icon-button> `;

View File

@ -13,7 +13,7 @@ import { HomeAssistant } from "../types";
@customElement("ha-icon-button-arrow-prev")
export class HaIconButtonArrowPrev extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property({ attribute: false }) public hass?: HomeAssistant;
@property({ type: Boolean }) public disabled = false;
@ -37,7 +37,7 @@ export class HaIconButtonArrowPrev extends LitElement {
return html`
<mwc-icon-button
.disabled=${this.disabled}
.label=${this.label || this.hass.localize("ui.common.back")}
.label=${this.label || this.hass?.localize("ui.common.back") || "Back"}
>
<ha-svg-icon .path=${this._icon}></ha-svg-icon>
</mwc-icon-button>

View File

@ -13,7 +13,7 @@ import { HomeAssistant } from "../types";
@customElement("ha-icon-button-next")
export class HaIconButtonNext extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property({ attribute: false }) public hass?: HomeAssistant;
@property({ type: Boolean }) public disabled = false;
@ -37,7 +37,7 @@ export class HaIconButtonNext extends LitElement {
return html`
<mwc-icon-button
.disabled=${this.disabled}
.label=${this.label || this.hass.localize("ui.common.next")}
.label=${this.label || this.hass?.localize("ui.common.next") || "Next"}
>
<ha-svg-icon .path=${this._icon}></ha-svg-icon>
</mwc-icon-button>

View File

@ -13,7 +13,7 @@ import { HomeAssistant } from "../types";
@customElement("ha-icon-button-prev")
export class HaIconButtonPrev extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property({ attribute: false }) public hass?: HomeAssistant;
@property({ type: Boolean }) public disabled = false;
@ -37,7 +37,7 @@ export class HaIconButtonPrev extends LitElement {
return html`
<mwc-icon-button
.disabled=${this.disabled}
.label=${this.label || this.hass.localize("ui.common.back")}
.label=${this.label || this.hass?.localize("ui.common.back") || "Back"}
>
<ha-svg-icon .path=${this._icon}></ha-svg-icon>
</mwc-icon-button>