fix(flow): preserve deployed trial runtime update batching

This commit is contained in:
Codex 2026-11-26 14:19:56 +08:00
parent 02f0133aec
commit e60419bd3b
3 changed files with 17 additions and 2 deletions

View File

@ -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({

View File

@ -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 || "工作流资源配置不完整");

View File

@ -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 对应的数据或交互;作用范围仅限画布适配层。