Skip to content

Commit

Permalink
fix: add judge to update variable node input (#1369)
Browse files Browse the repository at this point in the history
  • Loading branch information
newfish-cmyk authored May 6, 2024
1 parent db1c27c commit 5bb9c55
Showing 1 changed file with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,24 @@ const NodeVariableUpdate = ({ data, selected }: NodeProps<FlowNodeItemType>) =>
})();

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 (
<Flex key={index}>
<Container mt={4}>
<Container mt={4} w={'full'}>
<Flex alignItems={'center'}>
<Flex w={'60px'}>{t('core.workflow.variable')}</Flex>
<Reference
Expand Down Expand Up @@ -139,7 +149,7 @@ const NodeVariableUpdate = ({ data, selected }: NodeProps<FlowNodeItemType>) =>
)}
</Flex>
<Flex mt={2} w={'full'} alignItems={'center'} className="nodrag">
<Flex w={'60px'} flex={0}>
<Flex w={'60px'}>
<Box>{t('core.workflow.value')}</Box>
<MyTooltip
label={
Expand Down

0 comments on commit 5bb9c55

Please sign in to comment.