diff --git a/src/components/ha-sidebar.ts b/src/components/ha-sidebar.ts index 49daf43104..028fe8defd 100644 --- a/src/components/ha-sidebar.ts +++ b/src/components/ha-sidebar.ts @@ -287,27 +287,29 @@ class HaSidebar extends LitElement { ? html` ${this._hiddenPanels.map((url) => { const panel = this.hass.panels[url]; + if (!panel) { + return ""; + } return html` ${panel.url_path === "lovelace" + >${panel.url_path === this.hass.defaultPanel ? hass.localize("panel.states") : hass.localize(`panel.${panel.title}`) || panel.title} - + + + `; })}
@@ -544,7 +546,7 @@ class HaSidebar extends LitElement { private async _unhidePanel(ev: Event) { ev.preventDefault(); - const index = this._hiddenPanels.indexOf((ev.target as any).panel); + const index = this._hiddenPanels.indexOf((ev.currentTarget as any).panel); if (index < 0) { return; }