From 5bb9c550f666e551005e2bb3fd53ae9a38b02547 Mon Sep 17 00:00:00 2001 From: heheer <71265218+newfish-cmyk@users.noreply.github.com> Date: Mon, 6 May 2024 15:54:15 +0800 Subject: [PATCH] fix: add judge to update variable node input (#1369) --- .../Flow/nodes/NodeVariableUpdate.tsx | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/projects/app/src/components/core/workflow/Flow/nodes/NodeVariableUpdate.tsx b/projects/app/src/components/core/workflow/Flow/nodes/NodeVariableUpdate.tsx index 88b199766..0a56a9318 100644 --- a/projects/app/src/components/core/workflow/Flow/nodes/NodeVariableUpdate.tsx +++ b/projects/app/src/components/core/workflow/Flow/nodes/NodeVariableUpdate.tsx @@ -95,14 +95,24 @@ const NodeVariableUpdate = ({ data, selected }: NodeProps) => })(); const renderTypeData = menuList.find((item) => item.renderType === updateItem.renderType); - const handleUpdate = (newValue: any) => { - onUpdateList( - updateList.map((update, i) => (i === index ? { ...update, value: newValue } : update)) - ); + const handleUpdate = (newValue: ReferenceValueProps | string) => { + if (Array.isArray(newValue)) { + onUpdateList( + updateList.map((update, i) => + i === index ? { ...update, value: newValue } : update + ) + ); + } else { + onUpdateList( + updateList.map((update, i) => + i === index ? { ...update, value: ['', newValue] } : update + ) + ); + } }; return ( - + {t('core.workflow.variable')} ) => )} - + {t('core.workflow.value')}