From 39ae56e136c2bab219a64753260172330e3085f2 Mon Sep 17 00:00:00 2001 From: zxhlyh Date: Tue, 23 Apr 2024 18:02:15 +0800 Subject: [PATCH] fix: workflow connection (#3713) --- .../workflow/hooks/use-nodes-interactions.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/web/app/components/workflow/hooks/use-nodes-interactions.ts b/web/app/components/workflow/hooks/use-nodes-interactions.ts index 242e2d35a..b2a10d4b9 100644 --- a/web/app/components/workflow/hooks/use-nodes-interactions.ts +++ b/web/app/components/workflow/hooks/use-nodes-interactions.ts @@ -324,18 +324,12 @@ export const useNodesInteractions = () => { return } const needDeleteEdges = edges.filter((edge) => { - if (edge.source === source) { - if (edge.sourceHandle) - return edge.sourceHandle === sourceHandle - else - return true - } - if (edge.target === target) { - if (edge.targetHandle) - return edge.targetHandle === targetHandle - else - return true - } + if ( + (edge.source === source && edge.sourceHandle === sourceHandle) + || (edge.target === target && edge.targetHandle === targetHandle) + ) + return true + return false }) const needDeleteEdgesIds = needDeleteEdges.map(edge => edge.id)