From 6ccbeb8a75f300dc23ffcf304f61397bc55e5a33 Mon Sep 17 00:00:00 2001 From: karwosts <32912880+karwosts@users.noreply.github.com> Date: Sun, 26 May 2024 06:29:57 -0700 Subject: [PATCH] Fix entity picker delete button (#20875) --- src/components/entity/ha-entity-picker.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/entity/ha-entity-picker.ts b/src/components/entity/ha-entity-picker.ts index 88353724f2..6401b6cd21 100644 --- a/src/components/entity/ha-entity-picker.ts +++ b/src/components/entity/ha-entity-picker.ts @@ -405,9 +405,9 @@ export class HaEntityPicker extends LitElement { this._opened = ev.detail.value; } - private _valueChanged(ev: ValueChangedEvent) { + private _valueChanged(ev: ValueChangedEvent) { ev.stopPropagation(); - const newValue = ev.detail.value.trim(); + const newValue = ev.detail.value?.trim(); if (newValue && newValue.startsWith(CREATE_ID)) { const domain = newValue.substring(CREATE_ID.length); @@ -433,7 +433,7 @@ export class HaEntityPicker extends LitElement { : this._states; } - private _setValue(value: string) { + private _setValue(value: string | undefined) { this.value = value; setTimeout(() => { fireEvent(this, "value-changed", { value });