Skip to content

Commit

Permalink
Don't check for promise when processing DataEntryFlowStep (#23759)
Browse files Browse the repository at this point in the history
  • Loading branch information
farmio authored Jan 23, 2025
1 parent fb79e2c commit caeb616
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions src/dialogs/config-flow/dialog-data-entry-flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,32 +312,31 @@ class DataEntryFlowDialog extends LitElement {
private async _processStep(
step: DataEntryFlowStep | undefined | Promise<DataEntryFlowStep>
): Promise<void> {
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() {
Expand Down

0 comments on commit caeb616

Please sign in to comment.