Bläddra i källkod

fix(workflow): handle else condition branch addition error in if-else node (#10257)

tags/0.11.0
GeorgeCaoJ 1 år sedan
förälder
incheckning
cca2e7876d
Inget konto är kopplat till bidragsgivarens mejladress
1 ändrade filer med 8 tillägg och 8 borttagningar
  1. 8
    8
      web/app/components/workflow/nodes/if-else/use-config.ts

+ 8
- 8
web/app/components/workflow/nodes/if-else/use-config.ts Visa fil

}) })


const handleAddCase = useCallback(() => { const handleAddCase = useCallback(() => {
const newInputs = produce(inputs, () => {
if (inputs.cases) {
const newInputs = produce(inputs, (draft) => {
if (draft.cases) {
const case_id = uuid4() const case_id = uuid4()
inputs.cases.push({
draft.cases.push({
case_id, case_id,
logical_operator: LogicalOperator.and, logical_operator: LogicalOperator.and,
conditions: [], conditions: [],
}) })
if (inputs._targetBranches) {
const elseCaseIndex = inputs._targetBranches.findIndex(branch => branch.id === 'false')
if (draft._targetBranches) {
const elseCaseIndex = draft._targetBranches.findIndex(branch => branch.id === 'false')
if (elseCaseIndex > -1) { if (elseCaseIndex > -1) {
inputs._targetBranches = branchNameCorrect([
...inputs._targetBranches.slice(0, elseCaseIndex),
draft._targetBranches = branchNameCorrect([
...draft._targetBranches.slice(0, elseCaseIndex),
{ {
id: case_id, id: case_id,
name: '', name: '',
}, },
...inputs._targetBranches.slice(elseCaseIndex),
...draft._targetBranches.slice(elseCaseIndex),
]) ])
} }
} }

Laddar…
Avbryt
Spara