diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-11-16 18:26:22 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-16 18:26:22 -0800 |
commit | 357c752a213dbcf77e5333fa180cfef20a33842d (patch) | |
tree | e955e57cc1252b5fe759cde29185d62bb71bc339 /src/state/queries/profile-follows.ts | |
parent | 3043b324681f1702ca53831701fb5cecd14c0efb (diff) | |
download | voidsky-357c752a213dbcf77e5333fa180cfef20a33842d.tar.zst |
Move the current agent to a global and reset RQ queries on agent change (#1946)
Diffstat (limited to 'src/state/queries/profile-follows.ts')
-rw-r--r-- | src/state/queries/profile-follows.ts | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/state/queries/profile-follows.ts b/src/state/queries/profile-follows.ts index 71c51993d..8af1fba07 100644 --- a/src/state/queries/profile-follows.ts +++ b/src/state/queries/profile-follows.ts @@ -1,7 +1,7 @@ import {AppBskyGraphGetFollows} from '@atproto/api' import {useInfiniteQuery, InfiniteData, QueryKey} from '@tanstack/react-query' -import {useSession} from '#/state/session' +import {getAgent} from '#/state/session' import {STALE} from '#/state/queries' const PAGE_SIZE = 30 @@ -11,7 +11,6 @@ type RQPageParam = string | undefined export const RQKEY = (did: string) => ['profile-follows', did] export function useProfileFollowsQuery(did: string | undefined) { - const {agent} = useSession() return useInfiniteQuery< AppBskyGraphGetFollows.OutputSchema, Error, @@ -22,7 +21,7 @@ export function useProfileFollowsQuery(did: string | undefined) { staleTime: STALE.MINUTES.ONE, queryKey: RQKEY(did || ''), async queryFn({pageParam}: {pageParam: RQPageParam}) { - const res = await agent.app.bsky.graph.getFollows({ + const res = await getAgent().app.bsky.graph.getFollows({ actor: did || '', limit: PAGE_SIZE, cursor: pageParam, |