From e60419bd3b65f06892a94086cb0c3ac6ba21eb9c Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 26 Nov 2026 14:19:56 +0800 Subject: [PATCH] fix(flow): preserve deployed trial runtime update batching --- .../src/cmvr/common/views/flow/components/TestRun.vue | 4 +++- am-web/src/cmvr/common/views/flow/index.vue | 4 +++- am-web/src/cmvr/common/views/flow/vue-flow/adapter.js | 11 +++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/am-web/src/cmvr/common/views/flow/components/TestRun.vue b/am-web/src/cmvr/common/views/flow/components/TestRun.vue index a6ad321..3453f3e 100644 --- a/am-web/src/cmvr/common/views/flow/components/TestRun.vue +++ b/am-web/src/cmvr/common/views/flow/components/TestRun.vue @@ -247,7 +247,9 @@ const confirm = async () => { submitting.value = true try { const formData = formatTableData(tableData.value) - resourceValidation.graph.nodes.forEach((node) => emitter.emit('contentChange', { id: node.id })) + globalThis.lf.batchRuntimeUpdates(() => { + resourceValidation.graph.nodes.forEach((node) => emitter.emit('contentChange', { id: node.id })) + }) const executionDefinition = sanitizeFlowResourceDefinition(globalThis.lf.getGraphData()) const firstRobotId = runtimeAssignments.value.flatMap((item) => item.members).find((member) => member.robotId)?.robotId || '' const response = await flowExecuteTrial({ diff --git a/am-web/src/cmvr/common/views/flow/index.vue b/am-web/src/cmvr/common/views/flow/index.vue index 0dad948..e71202b 100644 --- a/am-web/src/cmvr/common/views/flow/index.vue +++ b/am-web/src/cmvr/common/views/flow/index.vue @@ -1677,7 +1677,9 @@ let oldFlowData = {}; const getSavableFlowData = () => { const graphData = lf.getGraphData(); - graphData.nodes.forEach((node) => emitter.emit("contentChange", { id: node.id })); + lf.batchRuntimeUpdates(() => { + graphData.nodes.forEach((node) => emitter.emit("contentChange", { id: node.id })); + }); const validation = validateFlowResources(lf.getGraphData()); if (validation.errors.length) { throw new Error(validation.errors[0].message || "工作流资源配置不完整"); diff --git a/am-web/src/cmvr/common/views/flow/vue-flow/adapter.js b/am-web/src/cmvr/common/views/flow/vue-flow/adapter.js index 1890889..c5208cd 100644 --- a/am-web/src/cmvr/common/views/flow/vue-flow/adapter.js +++ b/am-web/src/cmvr/common/views/flow/vue-flow/adapter.js @@ -742,6 +742,17 @@ export const createFlowFacade = (store) => { }, emit, markChanged: changed, + // Runtime display resets do not edit the definition. Avoid rebuilding a + // full undo snapshot once per node when preparing a large flow for trial. + batchRuntimeUpdates(update) { + const previous = historySuspended; + historySuspended = true; + try { + return update(); + } finally { + historySuspended = previous; + } + }, refreshVisualGroups, /** * 获取 getGraphData 对应的数据或交互;作用范围仅限画布适配层。