diff --git a/src/frontend/src/stores/flowsManagerStore.ts b/src/frontend/src/stores/flowsManagerStore.ts index 12007199e..90bf82169 100644 --- a/src/frontend/src/stores/flowsManagerStore.ts +++ b/src/frontend/src/stores/flowsManagerStore.ts @@ -1,3 +1,4 @@ +import { AxiosError } from "axios"; import { cloneDeep, debounce } from "lodash"; import { Edge, Node, Viewport, XYPosition } from "reactflow"; import { create } from "zustand"; @@ -84,7 +85,7 @@ const useFlowsManagerStore = create((set, get) => ({ readFlowsFromDatabase() .then((dbData) => { if (dbData) { - const { data, flows } = processFlows(dbData); + const { data, flows } = processFlows(dbData, false); const examples = flows.filter( (flow) => flow.folder_id === starterFolderId, ); @@ -154,9 +155,11 @@ const useFlowsManagerStore = create((set, get) => ({ } }) .catch((err) => { + useAlertStore.getState().setErrorData({ + title: "Error while saving changes", + list: [(err as AxiosError).message], + }); reject(err); - set({ saveLoading: false }); - throw err; }); }); }, SAVE_DEBOUNCE_TIME), @@ -229,6 +232,7 @@ const useFlowsManagerStore = create((set, get) => ({ // addFlowToLocalState(newFlow); return; } + console.log("folder id", folder_id); const newFlow = createNewFlow( flowData!, flow!, @@ -267,7 +271,7 @@ const useFlowsManagerStore = create((set, get) => ({ useFlowStore .getState() .paste( - { nodes: flow!.data!.nodes, edges: flow!.data!.edges }, + { nodes: flowData?.nodes, edges: flowData?.edges }, position ?? { x: 10, y: 10 }, ); }