mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-12 20:06:33 +00:00
Handle empty trigger or action in migration path (#22912)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
parent
5b8e63a213
commit
6ccd4fa431
@ -425,6 +425,10 @@ export const migrateAutomationConfig = <
|
||||
export const migrateAutomationTrigger = (
|
||||
trigger: Trigger | Trigger[]
|
||||
): Trigger | Trigger[] => {
|
||||
if (!trigger) {
|
||||
return trigger;
|
||||
}
|
||||
|
||||
if (Array.isArray(trigger)) {
|
||||
return trigger.map(migrateAutomationTrigger) as Trigger[];
|
||||
}
|
||||
|
@ -407,6 +407,10 @@ export const hasScriptFields = (
|
||||
export const migrateAutomationAction = (
|
||||
action: Action | Action[]
|
||||
): Action | Action[] => {
|
||||
if (!action) {
|
||||
return action;
|
||||
}
|
||||
|
||||
if (Array.isArray(action)) {
|
||||
return action.map(migrateAutomationAction) as Action[];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user