From c979cfb912a91062e5cb48acfb6cb9137e46f14c Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Sat, 12 Sep 2020 12:52:37 +0200 Subject: [PATCH] Fix sidebar for not existing hidden panel (#6944) Fixes #6940 --- src/components/ha-sidebar.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) 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; }