[Perf - part 1] Hoist service config query (#8812)

This commit is contained in:
Samuel Newman
2025-08-14 01:13:51 +03:00
committed by GitHub
parent b2c56cbd6d
commit 7a334362ae
12 changed files with 119 additions and 88 deletions
@@ -1,25 +0,0 @@
import {useQuery} from '@tanstack/react-query'
interface ServiceConfig {
checkEmailConfirmed: boolean
}
export function useServiceConfigQuery() {
return useQuery({
queryKey: ['service-config'],
queryFn: async () => {
const res = await fetch(
'https://api.bsky.app/xrpc/app.bsky.unspecced.getConfig',
)
if (!res.ok) {
return {
checkEmailConfirmed: false,
}
}
const json = await res.json()
return json as ServiceConfig
},
staleTime: 5 * 60 * 1000,
})
}