Files
Francesco SansalvadoreandAlaister Young a4cfcd9b2e global user dropdown in docs and www (#35063)
* docs: user nav dropdown

* www: user dropdown nav

* update menus

* chore: add complete local storage allowlist

* move all local-storage to common

* reload after logOut

* add local storage key changes from #35175

* fix errors

* add more keys

* fix merge bugs

---------

Co-authored-by: Alaister Young <a@alaisteryoung.com>
2025-05-05 11:48:06 +02:00

20 lines
546 B
TypeScript

import { LOCAL_STORAGE_KEYS } from 'common'
import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'
import { Dispatch, SetStateAction } from 'react'
/**
* 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]
}