fix: 切换流程时清空运行结果面板,避免显示上一流程的运行状态
This commit is contained in:
parent
7f3aaac2ff
commit
3a1c176f4d
@ -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 }),
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user