Fix condition key function for template shorthand notation (#18107)

This commit is contained in:
karwosts 2023-11-29 01:46:22 -08:00 committed by GitHub
parent 3a94deef69
commit e730649a8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -150,7 +150,7 @@ export default class HaAutomationCondition extends LitElement {
: null} : null}
<div class="conditions"> <div class="conditions">
${repeat( ${repeat(
this.conditions, this.conditions.filter((c) => typeof c === "object"),
(condition) => this._getKey(condition), (condition) => this._getKey(condition),
(cond, idx) => html` (cond, idx) => html`
<ha-automation-condition-row <ha-automation-condition-row
@ -348,6 +348,8 @@ export default class HaAutomationCondition extends LitElement {
conditions[index] = newValue; conditions[index] = newValue;
} }
this.conditions = conditions;
fireEvent(this, "value-changed", { value: conditions }); fireEvent(this, "value-changed", { value: conditions });
} }

View File

@ -558,10 +558,10 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
private _valueChanged(ev: CustomEvent<{ value: AutomationConfig }>) { private _valueChanged(ev: CustomEvent<{ value: AutomationConfig }>) {
ev.stopPropagation(); ev.stopPropagation();
this._config = ev.detail.value;
if (this._readOnly) { if (this._readOnly) {
return; return;
} }
this._config = ev.detail.value;
this._dirty = true; this._dirty = true;
this._errors = undefined; this._errors = undefined;
} }