From 6af589f592e81f9fd1b922744e13f77a869e562f Mon Sep 17 00:00:00 2001 From: farmio Date: Wed, 15 Jan 2025 20:13:49 +0100 Subject: [PATCH] Don't check for promise when processing DataEntryFlowStep --- .../config-flow/dialog-data-entry-flow.ts | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/dialogs/config-flow/dialog-data-entry-flow.ts b/src/dialogs/config-flow/dialog-data-entry-flow.ts index dfa328a40c5a..b86080222a63 100644 --- a/src/dialogs/config-flow/dialog-data-entry-flow.ts +++ b/src/dialogs/config-flow/dialog-data-entry-flow.ts @@ -312,32 +312,31 @@ class DataEntryFlowDialog extends LitElement { private async _processStep( step: DataEntryFlowStep | undefined | Promise ): Promise { - if (step instanceof Promise) { - this._loading = "loading_step"; - try { - this._step = await step; - } catch (err: any) { - this.closeDialog(); - showAlertDialog(this, { - title: this.hass.localize( - "ui.panel.config.integrations.config_flow.error" - ), - text: err?.body?.message, - }); - return; - } finally { - this._loading = undefined; - } + if (step === undefined) { + this.closeDialog(); return; } - if (step === undefined) { + this._loading = "loading_step"; + let _step: DataEntryFlowStep; + try { + _step = await step; + } catch (err: any) { this.closeDialog(); + showAlertDialog(this, { + title: this.hass.localize( + "ui.panel.config.integrations.config_flow.error" + ), + text: err?.body?.message, + }); return; + } finally { + this._loading = undefined; } + this._step = undefined; await this.updateComplete; - this._step = step; + this._step = _step; } private async _subscribeDataEntryFlowProgressed() {