sanity
Version:
Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches
14 lines (11 loc) • 409 B
text/typescript
import {useContext} from 'react'
import {
ActiveWorkspaceMatcherContext,
type ActiveWorkspaceMatcherContextValue,
} from './ActiveWorkspaceMatcherContext'
/** @internal */
export function useActiveWorkspace(): ActiveWorkspaceMatcherContextValue {
const value = useContext(ActiveWorkspaceMatcherContext)
if (!value) throw new Error('Could not find `ActiveWorkspaceMatcher` context')
return value
}