diff --git a/src/panels/config/automation/add-automation-element-dialog.ts b/src/panels/config/automation/add-automation-element-dialog.ts index d6affb018e..1b9a6a4180 100644 --- a/src/panels/config/automation/add-automation-element-dialog.ts +++ b/src/panels/config/automation/add-automation-element-dialog.ts @@ -289,6 +289,7 @@ class DialogAddAutomationElement public showDialog(params): void { this._params = params; + this._resetVariables(); this.addKeyboardShortcuts(); @@ -378,9 +379,15 @@ class DialogAddAutomationElement if (this._params) { fireEvent(this, "dialog-closed", { dialog: this.localName }); } + this._params = undefined; + this._resetVariables(); + + return true; + } + + private _resetVariables() { this._open = true; this._closing = false; - this._params = undefined; this._selectedCollectionIndex = undefined; this._selectedGroup = undefined; this._selectedTarget = undefined; @@ -392,7 +399,6 @@ class DialogAddAutomationElement this._narrow = false; this._targetItems = undefined; this._loadItemsError = false; - return true; } private _updateNarrow = () => {