mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
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:
parent
305cecb213
commit
265bbfc95d
@ -413,7 +413,7 @@ export const migrateAutomationConfig = <
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const flattenTriggers = (
|
export const flattenTriggers = (
|
||||||
triggers: undefined | (Trigger | TriggerList)[]
|
triggers: undefined | Trigger | (Trigger | TriggerList)[]
|
||||||
): Trigger[] => {
|
): Trigger[] => {
|
||||||
if (!triggers) {
|
if (!triggers) {
|
||||||
return [];
|
return [];
|
||||||
@ -421,7 +421,7 @@ export const flattenTriggers = (
|
|||||||
|
|
||||||
const flatTriggers: Trigger[] = [];
|
const flatTriggers: Trigger[] = [];
|
||||||
|
|
||||||
triggers.forEach((t) => {
|
ensureArray(triggers).forEach((t) => {
|
||||||
if ("triggers" in t) {
|
if ("triggers" in t) {
|
||||||
if (t.triggers) {
|
if (t.triggers) {
|
||||||
flatTriggers.push(...ensureArray(t.triggers));
|
flatTriggers.push(...ensureArray(t.triggers));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user