From 2c3e8970cbc4ad2eb39fd505a4292345c6cae1c0 Mon Sep 17 00:00:00 2001 From: Dries Augustyns Date: Wed, 11 Mar 2026 14:52:30 +0100 Subject: [PATCH] fix: Connect branches smoothly to original node --- apps/web/src/components/WorkflowBuilder.tsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/apps/web/src/components/WorkflowBuilder.tsx b/apps/web/src/components/WorkflowBuilder.tsx index 4c4247a..be2ba17 100644 --- a/apps/web/src/components/WorkflowBuilder.tsx +++ b/apps/web/src/components/WorkflowBuilder.tsx @@ -365,7 +365,8 @@ function CustomNode({ {data.config.mode === 'multi' ? (
- {data.config.branches?.length || 0} branch{(data.config.branches?.length || 0) !== 1 ? 'es' : ''} + default + {data.config.branches?.length || 0} branch{(data.config.branches?.length || 0) !== 1 ? 'es' : ''} + + default
) : (
@@ -551,7 +552,9 @@ export function WorkflowBuilder({workflowId, steps, onUpdate}: WorkflowBuilderPr const condition = transition.condition; const isConditional = condition && typeof condition === 'object' && 'branch' in condition; const branch = - condition && typeof condition === 'object' && 'branch' in condition ? (condition.branch as string) : undefined; + condition && typeof condition === 'object' && 'branch' in condition + ? (condition.branch as string) + : undefined; const branchColor = branch ? getBranchColor(step.config, branch) : '#94a3b8'; const branchLabel = branch ? getBranchLabel(step.config, branch) : undefined; @@ -597,7 +600,10 @@ export function WorkflowBuilder({workflowId, steps, onUpdate}: WorkflowBuilderPr expectedBranches.forEach(branchId => { const hasBranch = step.outgoingTransitions?.some( t => - t.condition && typeof t.condition === 'object' && 'branch' in t.condition && t.condition.branch === branchId, + t.condition && + typeof t.condition === 'object' && + 'branch' in t.condition && + t.condition.branch === branchId, ); if (!hasBranch) { @@ -608,7 +614,7 @@ export function WorkflowBuilder({workflowId, steps, onUpdate}: WorkflowBuilderPr id: `${step.id}-add-${branchId}-edge`, source: step.id, target: `${step.id}-add-${branchId}`, - type: 'straight', + type: 'smoothstep', animated: false, label, labelStyle: {fill: color, fontWeight: 600, fontSize: 12}, @@ -666,10 +672,7 @@ export function WorkflowBuilder({workflowId, steps, onUpdate}: WorkflowBuilderPr const connectedAddNodes = updatedNodes.filter(node => { if (node.type !== 'addStep') return false; // Check if this add node is connected to the moved node - return ( - node.id === `${movedNode.id}-add` || - node.id.startsWith(`${movedNode.id}-add-`) - ); + return node.id === `${movedNode.id}-add` || node.id.startsWith(`${movedNode.id}-add-`); }); // Update positions of connected "+" nodes to stay below parent