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/my-lists.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/my-lists.ts')
-rw-r--r-- | src/state/queries/my-lists.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/state/queries/my-lists.ts b/src/state/queries/my-lists.ts index 0b049e65f..3265cb21e 100644 --- a/src/state/queries/my-lists.ts +++ b/src/state/queries/my-lists.ts @@ -2,14 +2,14 @@ import {AppBskyGraphDefs} from '@atproto/api' import {useQuery, QueryClient} from '@tanstack/react-query' import {accumulate} from '#/lib/async/accumulate' -import {useSession} from '#/state/session' +import {useSession, getAgent} from '#/state/session' import {STALE} from '#/state/queries' export type MyListsFilter = 'all' | 'curate' | 'mod' export const RQKEY = (filter: MyListsFilter) => ['my-lists', filter] export function useMyListsQuery(filter: MyListsFilter) { - const {agent, currentAccount} = useSession() + const {currentAccount} = useSession() return useQuery<AppBskyGraphDefs.ListView[]>({ staleTime: STALE.MINUTES.ONE, queryKey: RQKEY(filter), @@ -17,8 +17,8 @@ export function useMyListsQuery(filter: MyListsFilter) { let lists: AppBskyGraphDefs.ListView[] = [] const promises = [ accumulate(cursor => - agent.app.bsky.graph - .getLists({ + getAgent() + .app.bsky.graph.getLists({ actor: currentAccount!.did, cursor, limit: 50, @@ -32,8 +32,8 @@ export function useMyListsQuery(filter: MyListsFilter) { if (filter === 'all' || filter === 'mod') { promises.push( accumulate(cursor => - agent.app.bsky.graph - .getListMutes({ + getAgent() + .app.bsky.graph.getListMutes({ cursor, limit: 50, }) @@ -45,8 +45,8 @@ export function useMyListsQuery(filter: MyListsFilter) { ) promises.push( accumulate(cursor => - agent.app.bsky.graph - .getListBlocks({ + getAgent() + .app.bsky.graph.getListBlocks({ cursor, limit: 50, }) |