From add482aee2f585618bcf316790401c81021d803f Mon Sep 17 00:00:00 2001 From: zhanghao <774378400@qq.com> Date: Fri, 7 Aug 2026 16:41:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8B=96=E5=8A=A8=E5=88=B0=E5=BE=AA?= =?UTF-8?q?=E7=8E=AF=E4=BD=93=E8=8A=82=E7=82=B9=E8=BF=9E=E7=BA=BF=E6=96=AD?= =?UTF-8?q?=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/flow/vue-flow/adapter.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/views/flow/vue-flow/adapter.js b/src/views/flow/vue-flow/adapter.js index 68aaa69..c3c66e1 100644 --- a/src/views/flow/vue-flow/adapter.js +++ b/src/views/flow/vue-flow/adapter.js @@ -791,10 +791,21 @@ export const createFlowFacade = (store) => { const group = store.findNode(groupId); const child = store.findNode(childId); if (!group || !child || GROUP_TYPES.has(child.data.flowType)) return; + const previousParentId = child.parentNode || child.data?.properties?.parentId; const graph = facade.getGraphData(); const groupData = graph.nodes.find((node) => node.id === groupId); const childData = graph.nodes.find((node) => node.id === childId); if (!groupData || !childData) return; + + // 节点从循环体外进入循环体后,原连线的两端已处于不同执行作用域,必须全部断开。 + // 在重新渲染父子结构前直接过滤图数据,可保证入边、出边和层级变更在同一次更新中完成。 + const enteringLoop = group.data.flowType === "loop" && previousParentId !== groupId; + if (enteringLoop) { + graph.edges = graph.edges.filter((edge) => ( + edge.sourceNodeId !== childId && edge.targetNodeId !== childId + )); + } + groupData.children = Array.from(new Set([...(groupData.children || []), childId])); childData.properties = { ...(childData.properties || {}), parentId: groupId }; if (dropCenter) {