Fix removal of option in select helper (#5777)

This commit is contained in:
Joakim Sørensen 2020-05-06 19:28:59 +02:00 committed by GitHub
parent 2d646da97f
commit 89f6f16ba2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -153,6 +153,7 @@ class HaInputSelectForm extends LitElement {
} }
private async _removeOption(ev: Event) { private async _removeOption(ev: Event) {
const index = (ev.target as any).index;
if ( if (
!(await showConfirmationDialog(this, { !(await showConfirmationDialog(this, {
title: "Delete this item?", title: "Delete this item?",
@ -161,7 +162,6 @@ class HaInputSelectForm extends LitElement {
) { ) {
return; return;
} }
const index = (ev.target as any).index;
const options = [...this._options]; const options = [...this._options];
options.splice(index, 1); options.splice(index, 1);
fireEvent(this, "value-changed", { fireEvent(this, "value-changed", {