From 01e9b2a5c45ad0aae6931f9f589113ded28932dd Mon Sep 17 00:00:00 2001 From: ZLY Date: Mon, 3 Nov 2025 11:05:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(flow):=20=E4=BF=AE=E5=A4=8D=E5=BE=AA?= =?UTF-8?q?=E7=8E=AF=E8=8A=82=E7=82=B9=E5=88=A0=E9=99=A4=E5=90=8E=E9=81=97?= =?UTF-8?q?=E7=95=99=E9=93=BE=E6=8E=A5=E7=BA=BF=E6=95=B0=E6=8D=AE=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/flowEditor/FlowEditorMain.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pages/flowEditor/FlowEditorMain.tsx b/src/pages/flowEditor/FlowEditorMain.tsx index fb35c24..4b72d44 100644 --- a/src/pages/flowEditor/FlowEditorMain.tsx +++ b/src/pages/flowEditor/FlowEditorMain.tsx @@ -279,8 +279,14 @@ const FlowEditorMain: React.FC = (props) => { index === self.findIndex(n => n.id === node.id) ); - // 删除所有相关节点 + // 删除所有相关节点和边 setNodes((nds) => nds.filter((n) => !nodesToRemove.find((d) => d.id === n.id))); + + // 删除与这些节点相关的所有边 + const nodeIdsToRemove = nodesToRemove.map(node => node.id); + setEdges((eds) => eds.filter((e) => + !nodeIdsToRemove.includes(e.source) && !nodeIdsToRemove.includes(e.target) + )); } else { // 普通节点删除