From 2f6bfa65f7f09febe22bd8734020c810682d28a3 Mon Sep 17 00:00:00 2001 From: Junyi Date: Mon, 14 Aug 2023 16:11:48 +0700 Subject: [PATCH] fix(plugin-workflow): fix assign attachment value in nodes (#2448) --- packages/plugins/workflow/src/client/variable.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/plugins/workflow/src/client/variable.tsx b/packages/plugins/workflow/src/client/variable.tsx index 419593d05..a3cd3baf9 100644 --- a/packages/plugins/workflow/src/client/variable.tsx +++ b/packages/plugins/workflow/src/client/variable.tsx @@ -126,7 +126,7 @@ export const BaseTypeSets = { // { type: 'reference', options: { collection: 'attachments', multiple: false } } // { type: 'reference', options: { collection: 'myExpressions', entity: false } } -function matchFieldType(field, type, appends): boolean { +function matchFieldType(field, type, appends?: string[]): boolean { const inputType = typeof type; if (inputType === 'string') { return BaseTypeSets[type]?.has(field.interface); @@ -264,10 +264,11 @@ function getNormalizedFields(collectionName, { compile, getCollectionFields }) { } async function loadChildren(option) { + const appends = getNextAppends(option.field, option.appends); const result = getCollectionFieldOptions({ collection: option.field.target, types: option.types, - appends: getNextAppends(option.field, option.appends), + appends, ...this, }); option.loadChildren = null; @@ -275,7 +276,7 @@ async function loadChildren(option) { option.children = result; } else { option.isLeaf = true; - const matchingType = option.types?.some((type) => matchFieldType(option.field, type, 0)); + const matchingType = option.types ? option.types.some((type) => matchFieldType(option.field, type, appends)) : true; if (!matchingType) { option.disabled = true; }