fix(plugin-workflow): fix adding/removing node in parallel branches (#253)
This commit is contained in:
		
							parent
							
								
									246e06eb7a
								
							
						
					
					
						commit
						c5e18903d2
					
				@ -43,6 +43,7 @@ export default {
 | 
				
			|||||||
    const [branchCount, setBranchCount] = useState(Math.max(2, branches.length));
 | 
					    const [branchCount, setBranchCount] = useState(Math.max(2, branches.length));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const tempBranches = Array(Math.max(0, branchCount - branches.length)).fill(null);
 | 
					    const tempBranches = Array(Math.max(0, branchCount - branches.length)).fill(null);
 | 
				
			||||||
 | 
					    const lastBranchHead = branches[branches.length - 1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return (
 | 
					    return (
 | 
				
			||||||
      <NodeDefaultView data={data}>
 | 
					      <NodeDefaultView data={data}>
 | 
				
			||||||
@ -51,11 +52,11 @@ export default {
 | 
				
			|||||||
            {branches.map((branch) => (
 | 
					            {branches.map((branch) => (
 | 
				
			||||||
              <Branch key={branch.id} from={data} entry={branch} branchIndex={branch.branchIndex} />
 | 
					              <Branch key={branch.id} from={data} entry={branch} branchIndex={branch.branchIndex} />
 | 
				
			||||||
            ))}
 | 
					            ))}
 | 
				
			||||||
            {tempBranches.map((branch, i) => (
 | 
					            {tempBranches.map((_, i) => (
 | 
				
			||||||
              <Branch
 | 
					              <Branch
 | 
				
			||||||
                key={`temp_${branches.length + i}`}
 | 
					                key={`temp_${branches.length + i}`}
 | 
				
			||||||
                from={data}
 | 
					                from={data}
 | 
				
			||||||
                branchIndex={branches.length + i}
 | 
					                branchIndex={(lastBranchHead ? lastBranchHead.branchIndex : 0) + i + 1}
 | 
				
			||||||
                controller={
 | 
					                controller={
 | 
				
			||||||
                  branches.length + i > 1
 | 
					                  branches.length + i > 1
 | 
				
			||||||
                    ? (
 | 
					                    ? (
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user