Skip to main content

useProjectStore

Datalayer Core


Datalayer Core / useProjectStore

Variable: useProjectStore

const useProjectStore: UseBoundStore<StoreApi<ProjectStoreState>>

Defined in: src/hooks/useProjectStore.ts:87

Zustand store for per-project runtime state (kernel connections, agents).

Not persisted — the data is ephemeral and only valid while the project component is mounted and a kernel/agent is active.

Usage:

import { useProjectStore } from '@datalayer/core/lib/hooks';

// In Project.tsx — store session when Notebook connects:
const setSessionConnection = useProjectStore(s => s.setSessionConnection);
<Notebook onSessionConnection={sc => setSessionConnection(projectId, sc)} />

// Anywhere — read the kernel for a project:
const kernel = useProjectStore(s => s.getKernel(projectId));