From 0abccb88d6f65246d636a9aab80f84b3267cf8c4 Mon Sep 17 00:00:00 2001 From: Petar Petrov Date: Fri, 14 Feb 2025 14:32:09 +0200 Subject: [PATCH] Fix inclusion dialog in ZwaveJS panel (#24234) --- .../zwave_js/zwave_js-config-dashboard.ts | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-dashboard.ts b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-dashboard.ts index 96b91b41f2..2ddef810e7 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-dashboard.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-dashboard.ts @@ -76,6 +76,8 @@ class ZWaveJSConfigDashboard extends SubscribeMixin(LitElement) { @state() private _statistics?: ZWaveJSControllerStatisticsUpdatedMessage; + private _dialogOpen = false; + protected async firstUpdated() { if (this.hass) { await this._fetchData(); @@ -104,11 +106,17 @@ class ZWaveJSConfigDashboard extends SubscribeMixin(LitElement) { } ), subscribeS2Inclusion(this.hass, this.configEntryId, (message) => { - showZWaveJSAddNodeDialog(this, { - entry_id: this.configEntryId, - dsk: message.dsk, - onStop: () => setTimeout(() => this._fetchData(), 100), - }); + if (!this._dialogOpen) { + showZWaveJSAddNodeDialog(this, { + entry_id: this.configEntryId, + dsk: message.dsk, + onStop: () => { + setTimeout(() => this._fetchData(), 100); + this._dialogOpen = false; + }, + }); + this._dialogOpen = true; + } }), ]; } @@ -570,11 +578,17 @@ class ZWaveJSConfigDashboard extends SubscribeMixin(LitElement) { } private async _addNodeClicked() { - showZWaveJSAddNodeDialog(this, { - entry_id: this.configEntryId!, - // refresh the data after the dialog is closed. add a small delay for the inclusion state to update - onStop: () => setTimeout(() => this._fetchData(), 100), - }); + if (!this._dialogOpen) { + showZWaveJSAddNodeDialog(this, { + entry_id: this.configEntryId!, + // refresh the data after the dialog is closed. add a small delay for the inclusion state to update + onStop: () => { + setTimeout(() => this._fetchData(), 100); + this._dialogOpen = false; + }, + }); + this._dialogOpen = true; + } } private async _removeNodeClicked() {