Files
supabase/apps/studio/hooks/misc/useSchemasForAi.ts
Charis 180ce515f6 style: require @ imports and sort imports for studio/hooks (#44444)
* **Chores**
* Updated internal module import paths across hook files to use
standardized path aliases for improved code consistency and
maintainability.
2026-04-01 11:48:02 -04:00

21 lines
549 B
TypeScript

import { LOCAL_STORAGE_KEYS } from 'common'
import { Dispatch, SetStateAction } from 'react'
import { useLocalStorageQuery } from '@/hooks/misc/useLocalStorage'
/**
* Returns which schemas are ok to be sent to AI.
*/
export function useSchemasForAi(
ref: string
): readonly [string[], Dispatch<SetStateAction<string[]>>] {
const [enabledSchemas, setEnabledSchemas] = useLocalStorageQuery(
LOCAL_STORAGE_KEYS.SQL_EDITOR_AI_SCHEMA(ref),
['public']
)
if (!ref) return [[], () => {}]
return [enabledSchemas, setEnabledSchemas]
}