Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

697 B
Raw Blame
import { useRefWithInit } from '@langgenius/dify-ui/use-ref-with-init'
import { createContext } from 'react'
import { createDataSourceStore } from './'

type DataSourceStoreApi = ReturnType<typeof createDataSourceStore>

type DataSourceContextType = DataSourceStoreApi | null

export const DataSourceContext = createContext<DataSourceContextType>(null)

type DataSourceProviderProps = {
  children: React.ReactNode
}

const DataSourceProvider = ({ children }: DataSourceProviderProps) => {
  const storeRef = useRefWithInit(createDataSourceStore)

  return (
    <DataSourceContext.Provider value={storeRef.current}>{children}</DataSourceContext.Provider>
  )
}

export default DataSourceProvider