mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-19 18:59:07 +08:00
fix: update operate and value
This commit is contained in:
parent
876ea90fe9
commit
7ad409b3d9
@ -68,21 +68,28 @@ const ConditionItem = ({
|
||||
|
||||
const [isHovered, setIsHovered] = useState(false)
|
||||
|
||||
const doUpdateCondition = useCallback((newCondition: Condition) => {
|
||||
if (isSubVariableKey)
|
||||
onUpdateSubVariableCondition?.(caseId, conditionId, condition.id, newCondition)
|
||||
else
|
||||
onUpdateCondition(caseId, condition.id, newCondition)
|
||||
}, [caseId, condition, conditionId, isSubVariableKey, onUpdateCondition, onUpdateSubVariableCondition])
|
||||
|
||||
const handleUpdateConditionOperator = useCallback((value: ComparisonOperator) => {
|
||||
const newCondition = {
|
||||
...condition,
|
||||
comparison_operator: value,
|
||||
}
|
||||
onUpdateCondition(caseId, condition.id, newCondition)
|
||||
}, [caseId, condition, onUpdateCondition])
|
||||
doUpdateCondition(newCondition)
|
||||
}, [condition, doUpdateCondition])
|
||||
|
||||
const handleUpdateConditionValue = useCallback((value: string) => {
|
||||
const newCondition = {
|
||||
...condition,
|
||||
value,
|
||||
}
|
||||
onUpdateCondition(caseId, condition.id, newCondition)
|
||||
}, [caseId, condition, onUpdateCondition])
|
||||
doUpdateCondition(newCondition)
|
||||
}, [condition, doUpdateCondition])
|
||||
|
||||
const handleUpdateConditionNumberVarType = useCallback((numberVarType: NumberVarType) => {
|
||||
const newCondition = {
|
||||
|
@ -40,8 +40,8 @@ type Props = {
|
||||
|
||||
const ConditionWrap: FC<Props> = ({
|
||||
isSubVariable,
|
||||
caseId: conditionParentCaseId,
|
||||
conditionId: parentConditionId,
|
||||
caseId,
|
||||
conditionId,
|
||||
nodeId: id,
|
||||
cases = [],
|
||||
readOnly,
|
||||
@ -118,8 +118,8 @@ const ConditionWrap: FC<Props> = ({
|
||||
<ConditionList
|
||||
disabled={readOnly}
|
||||
caseItem={item}
|
||||
caseId={isSubVariable ? conditionParentCaseId! : item.case_id}
|
||||
conditionId={parentConditionId}
|
||||
caseId={isSubVariable ? caseId! : item.case_id}
|
||||
conditionId={conditionId}
|
||||
onUpdateCondition={handleUpdateCondition}
|
||||
onRemoveCondition={handleRemoveCondition}
|
||||
onUpdateConditionLogicalOperator={handleUpdateConditionLogicalOperator}
|
||||
@ -146,7 +146,7 @@ const ConditionWrap: FC<Props> = ({
|
||||
<Button
|
||||
size='small'
|
||||
disabled={readOnly}
|
||||
onClick={() => handleAddSubVariableCondition?.(conditionParentCaseId!, parentConditionId!)}
|
||||
onClick={() => handleAddSubVariableCondition?.(caseId!, conditionId!)}
|
||||
>
|
||||
<RiAddLine className='mr-1 w-3.5 h-3.5' />
|
||||
{t('workflow.nodes.ifElse.addSubVariable')}
|
||||
@ -190,7 +190,7 @@ const ConditionWrap: FC<Props> = ({
|
||||
<Button
|
||||
size='small'
|
||||
disabled={readOnly}
|
||||
onClick={() => handleAddSubVariableCondition?.(conditionParentCaseId!, parentConditionId!)}
|
||||
onClick={() => handleAddSubVariableCondition?.(caseId!, conditionId!)}
|
||||
>
|
||||
<RiAddLine className='mr-1 w-3.5 h-3.5' />
|
||||
{t('workflow.nodes.ifElse.addSubVariable')}
|
||||
|
Loading…
x
Reference in New Issue
Block a user