Fix sequence action copy-paste (#27652)

This commit is contained in:
karwosts
2025-11-08 06:50:38 -08:00
committed by GitHub
parent 1cd7a1cd78
commit 9091df9db5
3 changed files with 12 additions and 2 deletions

View File

@@ -222,6 +222,7 @@ export interface StopAction extends BaseAction {
export interface SequenceAction extends BaseAction { export interface SequenceAction extends BaseAction {
sequence: (ManualScriptConfig | Action)[]; sequence: (ManualScriptConfig | Action)[];
metadata?: {};
} }
export interface ParallelAction extends BaseAction { export interface ParallelAction extends BaseAction {
@@ -479,6 +480,7 @@ export const migrateAutomationAction = (
} }
if (typeof action === "object" && action !== null && "sequence" in action) { if (typeof action === "object" && action !== null && "sequence" in action) {
delete (action as SequenceAction).metadata;
for (const sequenceAction of (action as SequenceAction).sequence) { for (const sequenceAction of (action as SequenceAction).sequence) {
migrateAutomationAction(sequenceAction); migrateAutomationAction(sequenceAction);
} }

View File

@@ -588,7 +588,11 @@ export default class HaAutomationActionRow extends LitElement {
...this._clipboard, ...this._clipboard,
action: deepClone(this.action), action: deepClone(this.action),
}; };
copyToClipboard(dump(this.action)); let action = this.action;
if ("sequence" in action) {
action = { ...this.action, metadata: {} };
}
copyToClipboard(dump(action));
} }
private _onDisable = () => { private _onDisable = () => {

View File

@@ -371,7 +371,11 @@ export class HaManualScriptEditor extends LitElement {
} }
} }
if (!["sequence", "unknown"].includes(getActionType(config))) { const actionType = getActionType(config);
if (
!["sequence", "unknown"].includes(actionType) ||
(actionType === "sequence" && "metadata" in config)
) {
config = { sequence: [config] }; config = { sequence: [config] };
} }