diff --git a/src/renderer/src/store/editorStore.ts b/src/renderer/src/store/editorStore.ts index 7fc31d4..1c2bf21 100644 --- a/src/renderer/src/store/editorStore.ts +++ b/src/renderer/src/store/editorStore.ts @@ -8,6 +8,7 @@ import type { FlowNodeOptions, FlowVariable } from "@shared/types"; +import { useRunStore } from "./runStore"; const clone = (value: T): T => structuredClone(value); @@ -111,7 +112,12 @@ export const useEditorStore = create((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 }),