From f032d0dbcf1337b0744165bf709fa83f6877cc7d Mon Sep 17 00:00:00 2001 From: "David F. Mulcahey" Date: Sun, 4 Sep 2022 22:25:03 -0400 Subject: [PATCH] Fix ZHA visualization page (#13584) --- .../zha/zha-config-dashboard-router.ts | 2 +- .../zha/zha-network-visualization-page.ts | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard-router.ts b/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard-router.ts index 8b0963b190..758f8acf0e 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard-router.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard-router.ts @@ -60,7 +60,7 @@ class ZHAConfigDashboardRouter extends HassRouterPage { } else if (this._currentPage === "device") { el.ieee = this.routeTail.path.substr(1); } else if (this._currentPage === "visualization") { - el.zoomedDeviceId = this.routeTail.path.substr(1); + el.zoomedDeviceIdFromURL = this.routeTail.path.substr(1); } const searchParams = new URLSearchParams(window.location.search); diff --git a/src/panels/config/integrations/integration-panels/zha/zha-network-visualization-page.ts b/src/panels/config/integrations/integration-panels/zha/zha-network-visualization-page.ts index 82af56463b..b321222084 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-network-visualization-page.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-network-visualization-page.ts @@ -37,7 +37,10 @@ export class ZHANetworkVisualizationPage extends LitElement { @property({ type: Boolean }) public isWide!: boolean; @property() - public zoomedDeviceId?: string; + public zoomedDeviceIdFromURL?: string; + + @state() + private zoomedDeviceId?: string; @query("#visualization", true) private _visualization?: HTMLElement; @@ -64,6 +67,11 @@ export class ZHANetworkVisualizationPage extends LitElement { protected firstUpdated(changedProperties: PropertyValues): void { super.firstUpdated(changedProperties); + // prevent zoomedDeviceIdFromURL from being restored to zoomedDeviceId after the user clears it + if (this.zoomedDeviceIdFromURL) { + this.zoomedDeviceId = this.zoomedDeviceIdFromURL; + } + if (this.hass) { this._fetchData(); }