Skip to content

Commit 623b275

Browse files
GeorgeCaoJiamjoel
authored andcommitted
fix(workflow): handle else condition branch addition error in if-else node (#10257)
1 parent 93e9aeb commit 623b275

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

web/app/components/workflow/nodes/if-else/use-config.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -78,24 +78,24 @@ const useConfig = (id: string, payload: IfElseNodeType) => {
7878
})
7979

8080
const handleAddCase = useCallback(() => {
81-
const newInputs = produce(inputs, () => {
82-
if (inputs.cases) {
81+
const newInputs = produce(inputs, (draft) => {
82+
if (draft.cases) {
8383
const case_id = uuid4()
84-
inputs.cases.push({
84+
draft.cases.push({
8585
case_id,
8686
logical_operator: LogicalOperator.and,
8787
conditions: [],
8888
})
89-
if (inputs._targetBranches) {
90-
const elseCaseIndex = inputs._targetBranches.findIndex(branch => branch.id === 'false')
89+
if (draft._targetBranches) {
90+
const elseCaseIndex = draft._targetBranches.findIndex(branch => branch.id === 'false')
9191
if (elseCaseIndex > -1) {
92-
inputs._targetBranches = branchNameCorrect([
93-
...inputs._targetBranches.slice(0, elseCaseIndex),
92+
draft._targetBranches = branchNameCorrect([
93+
...draft._targetBranches.slice(0, elseCaseIndex),
9494
{
9595
id: case_id,
9696
name: '',
9797
},
98-
...inputs._targetBranches.slice(elseCaseIndex),
98+
...draft._targetBranches.slice(elseCaseIndex),
9999
])
100100
}
101101
}

0 commit comments

Comments
 (0)