From 75002c0e27e5295b76dbd9302ac80f502b7db964 Mon Sep 17 00:00:00 2001 From: Shuchang Zheng Date: Mon, 6 Jan 2025 07:14:08 -0800 Subject: [PATCH] fix a bug where too many adder nodes are added (#1499) --- .../src/routes/workflows/editor/workflowEditorUtils.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts index c4f19466d..33a9d2b63 100644 --- a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts +++ b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts @@ -583,16 +583,14 @@ function getElements( ), ); const children = data.filter((b) => b.parentId === block.id); + const adderNodeId = nanoid(); if (children.length === 0) { - const adderNodeId = nanoid(); - nodes.push(nodeAdderNode(adderNodeId, block.id)); edges.push(defaultEdge(startNodeId, adderNodeId)); } else { const firstChild = children.find((c) => c.previous === null)!; edges.push(edgeWithAddButton(startNodeId, firstChild.id)); } const lastChild = children.find((c) => c.next === null); - const adderNodeId = nanoid(); nodes.push(nodeAdderNode(adderNodeId, block.id)); if (lastChild) { edges.push(defaultEdge(lastChild.id, adderNodeId));