From a01e0f265d29dadb300ce1a435508231016e7a23 Mon Sep 17 00:00:00 2001 From: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com> Date: Wed, 14 May 2025 16:22:26 -0300 Subject: [PATCH] fix: remove connected edges when enabling tool mode for them to not reconnect later (#8047) added tool mode cleaning on cleanEdges --- src/frontend/src/utils/reactflowUtils.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/utils/reactflowUtils.ts b/src/frontend/src/utils/reactflowUtils.ts index e218d6f7f..dea4103cf 100644 --- a/src/frontend/src/utils/reactflowUtils.ts +++ b/src/frontend/src/utils/reactflowUtils.ts @@ -95,6 +95,7 @@ export function cleanEdges(nodes: AllNodeType[], edges: EdgeType[]) { const templateFieldType = targetNode.data.node!.template[field]?.type; const inputTypes = targetNode.data.node!.template[field]?.input_types; const hasProxy = targetNode.data.node!.template[field]?.proxy; + const isToolMode = targetNode.data.node!.template[field]?.tool_mode; if ( !field && @@ -124,7 +125,10 @@ export function cleanEdges(nodes: AllNodeType[], edges: EdgeType[]) { id.proxy = targetNode.data.node!.template[field]?.proxy; } } - if (scapedJSONStringfy(id) !== targetHandle) { + if ( + scapedJSONStringfy(id) !== targetHandle || + (targetNode.data.node?.tool_mode && isToolMode) + ) { newEdges = newEdges.filter((e) => e.id !== edge.id); } }