Prefetch profile links on web (#2634)
This commit is contained in:
parent
157404132f
commit
23a4bbf608
4 changed files with 34 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue