Triggers doesn't have to be an array, fix flattenTriggers (#22072)

Triggers doesnt have to be an array, fix flattenTriggers
This commit is contained in:
Bram Kragten 2024-09-25 10:17:37 +02:00 committed by GitHub
parent 305cecb213
commit 265bbfc95d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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));