Prefetch profile links on web (#2634)

This commit is contained in:
dan 2024-01-26 05:23:56 +00:00 committed by GitHub
parent 157404132f
commit 23a4bbf608
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 34 additions and 1 deletions

View file

@ -57,6 +57,23 @@ export function useProfilesQuery({handles}: {handles: string[]}) {
})
}
export function usePrefetchProfileQuery() {
const queryClient = useQueryClient()
const prefetchProfileQuery = useCallback(
(did: string) => {
queryClient.prefetchQuery({
queryKey: RQKEY(did),
queryFn: async () => {
const res = await getAgent().getProfile({actor: did || ''})
return res.data
},
})
},
[queryClient],
)
return prefetchProfileQuery
}
interface ProfileUpdateParams {
profile: AppBskyActorDefs.ProfileView
updates: