diff --git a/src/data/automation.ts b/src/data/automation.ts index 10c193cd9d46..1cae92060b61 100644 --- a/src/data/automation.ts +++ b/src/data/automation.ts @@ -413,7 +413,7 @@ export const migrateAutomationConfig = < }; export const flattenTriggers = ( - triggers: undefined | (Trigger | TriggerList)[] + triggers: undefined | Trigger | (Trigger | TriggerList)[] ): Trigger[] => { if (!triggers) { return []; @@ -421,7 +421,7 @@ export const flattenTriggers = ( const flatTriggers: Trigger[] = []; - triggers.forEach((t) => { + ensureArray(triggers).forEach((t) => { if ("triggers" in t) { if (t.triggers) { flatTriggers.push(...ensureArray(t.triggers));