fix: 切换流程时清空运行结果面板,避免显示上一流程的运行状态

This commit is contained in:
yu 2026-10-28 16:04:44 +08:00
parent 7f3aaac2ff
commit 3a1c176f4d

View File

@ -8,6 +8,7 @@ import type {
FlowNodeOptions,
FlowVariable
} from "@shared/types";
import { useRunStore } from "./runStore";
const clone = <T,>(value: T): T => structuredClone(value);
@ -111,7 +112,12 @@ export const useEditorStore = create<EditorState>((set, get) => {
setCatalog: (catalog) => set({ catalog }),
loadFlow: (flow) => set({ flow, selectedNodeId: null, dirty: false, past: [], future: [] }),
loadFlow: (flow) => {
// 切换流程时清掉上一次的运行面板状态,避免显示旧流程的运行结果
const runState = useRunStore.getState();
if (!runState.running) runState.clear();
set({ flow, selectedNodeId: null, dirty: false, past: [], future: [] });
},
selectNode: (id) => set({ selectedNodeId: id }),