Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { Condition } from "../../../../../data/automation";
import { Action, ChooseAction } from "../../../../../data/script";
import { haStyle } from "../../../../../resources/styles";
import { HomeAssistant } from "../../../../../types";
import "../ha-automation-action";
import { ActionElement } from "../ha-automation-action-row";
import "../../../../../components/ha-form/ha-form";

@customElement("ha-automation-action-choose")
export class HaChooseAction extends LitElement implements ActionElement {
Expand Down Expand Up @@ -61,12 +61,13 @@ export class HaChooseAction extends LitElement implements ActionElement {
"ui.panel.config.automation.editor.actions.type.choose.sequence"
)}:
</h3>
<ha-automation-action
.actions=${option.sequence}
<ha-form
.hass=${this.hass}
.schema=${[{ name: "sequence", selector: { action: {} } }]}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't create static objects in render, as they will be recreated on every render (every state change), they will not pass a strict equality check and thus will cause a re-render down the line while not needed.

.data=${option}
.idx=${idx}
@value-changed=${this._actionChanged}
></ha-automation-action>
></ha-form>
</div>
</ha-card>`
)}
Expand Down Expand Up @@ -107,7 +108,7 @@ export class HaChooseAction extends LitElement implements ActionElement {

private _actionChanged(ev: CustomEvent) {
ev.stopPropagation();
const value = ev.detail.value as Action[];
const value = ev.detail.value.sequence as Action[];
const index = (ev.target as any).idx;
const choose = this.action.choose
? [...ensureArray(this.action.choose)]
Expand Down