mirror of
https://github.com/supabase/supabase.git
synced 2026-07-05 08:04:38 +08:00
Add all the outstanding pieces for state management of new command menu: - Pages state (handles routing between command menu views, e.g., docs search, AI, etc.) - View state (handles opening and closing and initiation (needed for lazy loading)) - Query state (handles active search term)
18 lines
325 B
TypeScript
18 lines
325 B
TypeScript
import { proxy } from 'valtio'
|
|
|
|
type IQueryState = {
|
|
query: string
|
|
setQuery: (newQuery: string) => void
|
|
}
|
|
|
|
const initQueryState = () => {
|
|
const state: IQueryState = proxy({
|
|
query: '',
|
|
setQuery: (newQuery) => (state.query = newQuery),
|
|
})
|
|
return state
|
|
}
|
|
|
|
export { initQueryState }
|
|
export type { IQueryState }
|