diff --git a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx index c27e8d64e..4a88719b4 100644 --- a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx @@ -42,6 +42,8 @@ export default function Page({ flow }: { flow: FlowType }) { paste, lastCopiedSelection, setLastCopiedSelection, + tabsState, + saveFlow } = useContext(TabsContext); const { types, reactFlowInstance, setReactFlowInstance, templates } = useContext(typesContext); @@ -250,6 +252,14 @@ export default function Page({ flow }: { flow: FlowType }) { // Specify dependencies for useCallback [getNodeId, reactFlowInstance, setErrorData, setNodes, takeSnapshot] ); + + useEffect(() => { + return () => { + if(tabsState && tabsState[flow.id]?.isPending) { + saveFlow(flow) + } + } + },[]) const onDelete = useCallback( (mynodes) => {