Files
supabase/packages/ui-patterns/src/CommandMenu/internal/Context.tsx
T
Ivan Vasilov 1cd1ebfc7f chire: Sort imports in all packages, cms, design-system and ui-library apps (#41610)
Sorted all imports in all packages, `cms`, `design-system` and
`ui-library` apps by running `pnpm format` on them.

All changes in this PR are done by the script.
2026-02-05 13:54:10 +01:00

27 lines
743 B
TypeScript

'use client'
import { createContext, useContext } from 'react'
import { type IPagesState } from '../internal/state/pagesState'
import { type IQueryState } from '../internal/state/queryState'
import { type IViewState } from '../internal/state/viewState.types'
import { type ICommandsState } from '../internal/types'
const CommandContext = createContext<
| {
commandsState: ICommandsState
pagesState: IPagesState
queryState: IQueryState
viewState: IViewState
}
| undefined
>(undefined)
const useCommandContext = () => {
const ctx = useContext(CommandContext)
if (!ctx) throw Error('`useCommandContext` must be used within a `CommandProvider`')
return ctx
}
export { CommandContext, useCommandContext }