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
4 changed files with 34 additions and 1 deletions
+17
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: