Prevent automation action row issue if event name gets cleared (#8213)

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
Philip Allgaier 2021-01-25 20:01:30 +01:00 committed by GitHub
parent a8b27e224f
commit cf43b26e14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,7 @@ import {
query,
} from "lit-element";
import { html } from "lit-html";
import { fireEvent } from "../../../../../common/dom/fire_event";
import "../../../../../components/entity/ha-entity-picker";
import "../../../../../components/ha-service-picker";
import "../../../../../components/ha-yaml-editor";
@ -51,7 +52,7 @@ export class HaEventAction extends LitElement implements ActionElement {
)}
name="event"
.value=${event}
@value-changed=${this._valueChanged}
@value-changed=${this._eventChanged}
></paper-input>
<ha-yaml-editor
.label=${this.hass.localize(
@ -73,8 +74,11 @@ export class HaEventAction extends LitElement implements ActionElement {
handleChangeEvent(this, ev);
}
private _valueChanged(ev: CustomEvent): void {
handleChangeEvent(this, ev);
private _eventChanged(ev: CustomEvent): void {
ev.stopPropagation();
fireEvent(this, "value-changed", {
value: { ...this.action, event: ev.detail.value },
});
}
}