migrate the actor search and autocomplete queries to the appview client

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-08-03 17:45:44 +03:00
parent 38042dcc02
commit c0aafe4ffd
5 changed files with 49 additions and 37 deletions
+7 -6
View File
@@ -1,13 +1,14 @@
import {useCallback, useEffect, useState} from 'react'
import {View} from 'react-native'
import {useSafeAreaInsets} from 'react-native-safe-area-context'
import {type DidString} from '@atproto/syntax'
import {useLingui} from '@lingui/react/macro'
import {useQueryClient} from '@tanstack/react-query'
import {PressableScale} from '#/lib/custom-animations/PressableScale'
import {STALE} from '#/state/queries'
import {profilesQueryKey} from '#/state/queries/profile'
import {useAgent, useSession} from '#/state/session'
import {useAppviewClient, useSession} from '#/state/session'
import {useSetActiveLanding} from '#/state/shell/landing'
import {
useLoggedOutView,
@@ -23,6 +24,7 @@ import {atoms as a, native, tokens, useTheme} from '#/alf'
import {Button, ButtonIcon} from '#/components/Button'
import {TimesLarge_Stroke2_Corner0_Rounded as XIcon} from '#/components/icons/Times'
import {useAnalytics} from '#/analytics'
import {app} from '#/lexicons'
import {SplashScreen} from './SplashScreen'
enum ScreenState {
@@ -65,19 +67,18 @@ export function LoggedOut({onDismiss}: {onDismiss?: () => void}) {
const queryClient = useQueryClient()
const {accounts} = useSession()
const agent = useAgent()
const client = useAppviewClient()
useEffect(() => {
const actors = accounts.map(acc => acc.did)
const actors = accounts.map(acc => acc.did as DidString)
if (actors.length === 0) return
void queryClient.prefetchQuery({
queryKey: profilesQueryKey(actors),
staleTime: STALE.MINUTES.FIVE,
queryFn: async () => {
const res = await agent.getProfiles({actors})
return res.data
return await client.call(app.bsky.actor.getProfiles, {actors})
},
})
}, [accounts, agent, queryClient])
}, [accounts, client, queryClient])
const onPressDismiss = useCallback(() => {
if (onDismiss) {