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/search-posts.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/search-posts.ts')
-rw-r--r-- | src/state/queries/search-posts.ts | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/state/queries/search-posts.ts b/src/state/queries/search-posts.ts index ab6ed4d41..03f3ba339 100644 --- a/src/state/queries/search-posts.ts +++ b/src/state/queries/search-posts.ts @@ -1,7 +1,7 @@ import {AppBskyFeedSearchPosts} from '@atproto/api' import {useInfiniteQuery, InfiniteData, QueryKey} from '@tanstack/react-query' -import {useSession} from '#/state/session' +import {getAgent} from '#/state/session' const searchPostsQueryKey = ({query}: {query: string}) => [ 'search-posts', @@ -9,8 +9,6 @@ const searchPostsQueryKey = ({query}: {query: string}) => [ ] export function useSearchPostsQuery({query}: {query: string}) { - const {agent} = useSession() - return useInfiniteQuery< AppBskyFeedSearchPosts.OutputSchema, Error, @@ -20,7 +18,7 @@ export function useSearchPostsQuery({query}: {query: string}) { >({ queryKey: searchPostsQueryKey({query}), queryFn: async () => { - const res = await agent.app.bsky.feed.searchPosts({ + const res = await getAgent().app.bsky.feed.searchPosts({ q: query, limit: 25, }) |