diff --git a/src/frontend/src/stores/flowStore.ts b/src/frontend/src/stores/flowStore.ts index c993d87d0..c030a8344 100644 --- a/src/frontend/src/stores/flowStore.ts +++ b/src/frontend/src/stores/flowStore.ts @@ -41,6 +41,20 @@ const useFlowStore = create((set, get) => ({ inputTypes: [], inputIds: [], outputIds: [], + setFlowPool: (flowPool) => { + set({ flowPool }); + }, + addDataToFlowPool: (data: any, nodeId: string) => { + let newFlowPool = cloneDeep({ ...get().flowPool }); + if (!newFlowPool[nodeId]) newFlowPool[nodeId] = [data]; + else { + newFlowPool[nodeId].push(data); + } + get().setFlowPool(newFlowPool); + }, + CleanFlowPool: () => { + get().setFlowPool({}); + }, setPending: (isPending) => { set({ isPending }); }, diff --git a/src/frontend/src/types/zustand/flow/index.ts b/src/frontend/src/types/zustand/flow/index.ts index 20987704d..92d520934 100644 --- a/src/frontend/src/types/zustand/flow/index.ts +++ b/src/frontend/src/types/zustand/flow/index.ts @@ -37,6 +37,9 @@ export type FlowStoreType = { outputTypes: string[]; inputIds: string[]; outputIds: string[]; + setFlowPool: (flowPool: FlowPoolType) => void; + addDataToFlowPool: (data: any, nodeId: string) => void; + CleanFlowPool: () => void; updateSSEData: (sseData: object) => void; sseData: object; isBuilding: boolean; diff --git a/src/frontend/src/types/zustand/flowIOStore/index.ts b/src/frontend/src/types/zustand/flowIOStore/index.ts index 0e56f6933..1a4482a96 100644 --- a/src/frontend/src/types/zustand/flowIOStore/index.ts +++ b/src/frontend/src/types/zustand/flowIOStore/index.ts @@ -23,19 +23,11 @@ export type FlowPoolType = { }; export type flowIOStoreType = { - flowPool: FlowPoolType; - inputTypes: string[]; - outputTypes: string[]; - inputIds: string[]; - outputIds: string[]; - setFlowPool: (flowPool: FlowPoolType) => void; setOutputTypes: (outputTypes: string[]) => void; setInputTypes: (inputTypes: string[]) => void; setInputIds: (inputIds: string[]) => void; setOutputIds: (outputIds: string[]) => void; updateFlowPoolNodes: (nodes: NodeType[]) => void; - addDataToFlowPool: (data: any, nodeId: string) => void; - CleanFlowPool: () => void; checkInputandOutput: (flow?: FlowType) => boolean; getInputTypes: (flow?: FlowType) => string[]; getOutputTypes: (flow?: FlowType) => string[];