From 3ca5d970dc5ef09682842557882f6ee111e8f952 Mon Sep 17 00:00:00 2001 From: Rijk van Zanten Date: Fri, 3 Jun 2022 17:20:11 -0400 Subject: [PATCH] Don't crash on misconfigured scope trigger (#13723) Fixes #13697 --- .../modules/settings/routes/flows/triggers.ts | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/app/src/modules/settings/routes/flows/triggers.ts b/app/src/modules/settings/routes/flows/triggers.ts index eeb96df10c..201f9f0ef0 100644 --- a/app/src/modules/settings/routes/flows/triggers.ts +++ b/app/src/modules/settings/routes/flows/triggers.ts @@ -1,4 +1,5 @@ import { DeepPartial, Field, FlowRaw, TriggerType, Width } from '@directus/shared/types'; +import { toArray } from '@directus/shared/utils'; import { useI18n } from 'vue-i18n'; import { getPublicURL } from '../../../../utils/get-root-path'; @@ -33,15 +34,13 @@ export function getTriggers() { labels.push({ label: t('scope'), - text: scope.join(', '), + text: scope ? toArray(scope).join(', ') : '--', }); - if (collections?.length) { - labels.push({ - label: t('collections'), - text: collections.join(', '), - }); - } + labels.push({ + label: t('collections'), + text: collections ? toArray(collections).join(', ') : '--', + }); return labels; }, @@ -326,12 +325,10 @@ export function getTriggers() { }, ]; - if (collections?.length) { - labels.push({ - label: t('collections'), - text: collections.join(', '), - }); - } + labels.push({ + label: t('collections'), + text: collections ? toArray(collections).join(', ') : '--', + }); return labels; },