import { createContext, useRef, } from 'react' import { createWorkflowStore } from './store' type WorkflowStore = ReturnType export const WorkflowContext = createContext(null) type WorkflowProviderProps = { children: React.ReactNode } export const WorkflowContextProvider = ({ children }: WorkflowProviderProps) => { const storeRef = useRef() if (!storeRef.current) storeRef.current = createWorkflowStore() return ( {children} ) }