[SDK] Migrate profile and graph read queries to the appview client (#11356)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-08-13 22:26:15 +03:00
committed by GitHub
parent 855457c9fa
commit 0912119c77
14 changed files with 180 additions and 148 deletions
@@ -1,9 +1,11 @@
import {useCallback} from 'react'
import {type DidString} from '@atproto/syntax'
import {useQueryClient} from '@tanstack/react-query'
import {logger} from '#/logger'
import {updateProfileShadow} from '#/state/cache/profile-shadow'
import {useAgent} from '#/state/session'
import {useAppviewClient} from '#/state/session'
import {app} from '#/lexicons'
import type * as bsky from '#/types/bsky'
/**
@@ -13,13 +15,17 @@ import type * as bsky from '#/types/bsky'
*/
export function useUpdateProfileVerificationCache() {
const qc = useQueryClient()
const agent = useAgent()
const client = useAppviewClient()
return useCallback(
async ({profile}: {profile: bsky.profile.AnyProfileView}) => {
try {
const {data: updated} = await agent.getProfile({
actor: profile.did ?? '',
if (!profile.did) {
logger.warn(`useUpdateProfileVerificationCache: no did`, {profile})
return
}
const updated = await client.call(app.bsky.actor.getProfile, {
actor: profile.did as DidString,
})
updateProfileShadow(qc, profile.did, {
verification: updated.verification,
@@ -30,6 +36,6 @@ export function useUpdateProfileVerificationCache() {
})
}
},
[agent, qc],
[client, qc],
)
}