diff options
author | Hailey <me@haileyok.com> | 2024-06-21 21:38:04 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-21 21:38:04 -0700 |
commit | f089f4578131e83cd177b7809ce0f7b75779dfdc (patch) | |
tree | 51978aede2040fb8dc319f0749d3de77c7811fbe /src/state/queries/feed.ts | |
parent | 35f64535cb8dfa0fe46e740a6398f3b991ecfbc7 (diff) | |
download | voidsky-f089f4578131e83cd177b7809ce0f7b75779dfdc.tar.zst |
Starter Packs (#4332)
Co-authored-by: Dan Abramov <dan.abramov@gmail.com> Co-authored-by: Paul Frazee <pfrazee@gmail.com> Co-authored-by: Eric Bailey <git@esb.lol> Co-authored-by: Samuel Newman <mozzius@protonmail.com>
Diffstat (limited to 'src/state/queries/feed.ts')
-rw-r--r-- | src/state/queries/feed.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/state/queries/feed.ts b/src/state/queries/feed.ts index e5d615177..dea6f5d77 100644 --- a/src/state/queries/feed.ts +++ b/src/state/queries/feed.ts @@ -9,6 +9,7 @@ import { } from '@atproto/api' import { InfiniteData, + keepPreviousData, QueryClient, QueryKey, useInfiniteQuery, @@ -315,6 +316,22 @@ export function useSearchPopularFeedsMutation() { }) } +export function useSearchPopularFeedsQuery({q}: {q: string}) { + const agent = useAgent() + return useQuery({ + queryKey: ['searchPopularFeeds', q], + queryFn: async () => { + const res = await agent.app.bsky.unspecced.getPopularFeedGenerators({ + limit: 15, + query: q, + }) + + return res.data.feeds + }, + placeholderData: keepPreviousData, + }) +} + const popularFeedsSearchQueryKeyRoot = 'popularFeedsSearch' export const createPopularFeedsSearchQueryKey = (query: string) => [ popularFeedsSearchQueryKeyRoot, |