diff --git a/src/panels/config/entities/entity-registry-settings.ts b/src/panels/config/entities/entity-registry-settings.ts index a0090ff6a4..ac5ac1a30d 100644 --- a/src/panels/config/entities/entity-registry-settings.ts +++ b/src/panels/config/entities/entity-registry-settings.ts @@ -177,26 +177,27 @@ export class EntityRegistrySettings extends LitElement { } } - private async _deleteEntry(): Promise { + private async _confirmDeleteEntry(): Promise { + if ( + !(await showConfirmationDialog(this, { + text: this.hass.localize( + "ui.dialogs.entity_registry.editor.confirm_delete" + ), + })) + ) { + return; + } + this._submitting = true; try { - await removeEntityRegistryEntry(this.hass!, this._entityId); + await removeEntityRegistryEntry(this.hass!, this._origEntityId); fireEvent(this as HTMLElement, "close-dialog"); } finally { this._submitting = false; } } - private _confirmDeleteEntry(): void { - showConfirmationDialog(this, { - text: this.hass.localize( - "ui.dialogs.entity_registry.editor.confirm_delete" - ), - confirm: () => this._deleteEntry(), - }); - } - private _disabledByChanged(ev: Event): void { this._disabledBy = (ev.target as HaSwitch).checked ? null : "user"; }