mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-13 04:16:34 +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 = (
|
export const migrateAutomationTrigger = (
|
||||||
trigger: Trigger | Trigger[]
|
trigger: Trigger | Trigger[]
|
||||||
): Trigger | Trigger[] => {
|
): Trigger | Trigger[] => {
|
||||||
|
if (!trigger) {
|
||||||
|
return trigger;
|
||||||
|
}
|
||||||
|
|
||||||
if (Array.isArray(trigger)) {
|
if (Array.isArray(trigger)) {
|
||||||
return trigger.map(migrateAutomationTrigger) as Trigger[];
|
return trigger.map(migrateAutomationTrigger) as Trigger[];
|
||||||
}
|
}
|
||||||
|
@ -407,6 +407,10 @@ export const hasScriptFields = (
|
|||||||
export const migrateAutomationAction = (
|
export const migrateAutomationAction = (
|
||||||
action: Action | Action[]
|
action: Action | Action[]
|
||||||
): Action | Action[] => {
|
): Action | Action[] => {
|
||||||
|
if (!action) {
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
if (Array.isArray(action)) {
|
if (Array.isArray(action)) {
|
||||||
return action.map(migrateAutomationAction) as Action[];
|
return action.map(migrateAutomationAction) as Action[];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user