fix: add judge to update variable node input (#1369)

This commit is contained in:
heheer
2024-05-06 15:54:15 +08:00
committed by GitHub
parent db1c27cdc7
commit 5bb9c550f6

View File

@@ -95,14 +95,24 @@ const NodeVariableUpdate = ({ data, selected }: NodeProps<FlowNodeItemType>) =>
})(); })();
const renderTypeData = menuList.find((item) => item.renderType === updateItem.renderType); const renderTypeData = menuList.find((item) => item.renderType === updateItem.renderType);
const handleUpdate = (newValue: any) => { const handleUpdate = (newValue: ReferenceValueProps | string) => {
onUpdateList( if (Array.isArray(newValue)) {
updateList.map((update, i) => (i === index ? { ...update, value: newValue } : update)) onUpdateList(
); updateList.map((update, i) =>
i === index ? { ...update, value: newValue } : update
)
);
} else {
onUpdateList(
updateList.map((update, i) =>
i === index ? { ...update, value: ['', newValue] } : update
)
);
}
}; };
return ( return (
<Flex key={index}> <Flex key={index}>
<Container mt={4}> <Container mt={4} w={'full'}>
<Flex alignItems={'center'}> <Flex alignItems={'center'}>
<Flex w={'60px'}>{t('core.workflow.variable')}</Flex> <Flex w={'60px'}>{t('core.workflow.variable')}</Flex>
<Reference <Reference
@@ -139,7 +149,7 @@ const NodeVariableUpdate = ({ data, selected }: NodeProps<FlowNodeItemType>) =>
)} )}
</Flex> </Flex>
<Flex mt={2} w={'full'} alignItems={'center'} className="nodrag"> <Flex mt={2} w={'full'} alignItems={'center'} className="nodrag">
<Flex w={'60px'} flex={0}> <Flex w={'60px'}>
<Box>{t('core.workflow.value')}</Box> <Box>{t('core.workflow.value')}</Box>
<MyTooltip <MyTooltip
label={ label={