fix(plugin-workflow): fix adding/removing node in parallel branches (#253)

This commit is contained in:
Junyi 2022-03-27 16:43:01 +08:00 committed by GitHub
parent 246e06eb7a
commit c5e18903d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,6 +43,7 @@ export default {
const [branchCount, setBranchCount] = useState(Math.max(2, branches.length));
const tempBranches = Array(Math.max(0, branchCount - branches.length)).fill(null);
const lastBranchHead = branches[branches.length - 1];
return (
<NodeDefaultView data={data}>
@ -51,11 +52,11 @@ export default {
{branches.map((branch) => (
<Branch key={branch.id} from={data} entry={branch} branchIndex={branch.branchIndex} />
))}
{tempBranches.map((branch, i) => (
{tempBranches.map((_, i) => (
<Branch
key={`temp_${branches.length + i}`}
from={data}
branchIndex={branches.length + i}
branchIndex={(lastBranchHead ? lastBranchHead.branchIndex : 0) + i + 1}
controller={
branches.length + i > 1
? (