diff options
author | dan <dan.abramov@gmail.com> | 2024-04-04 18:57:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-04 18:57:38 +0100 |
commit | b783745b2e4c1b4c3b55892ba05280808e5b370d (patch) | |
tree | 5c3fc20b51496d32934d250186c249de9bf7f515 /src/state/queries/search-posts.ts | |
parent | b26abf212efc0e50bf85a74d15bf7b5ce350cf5a (diff) | |
download | voidsky-b783745b2e4c1b4c3b55892ba05280808e5b370d.tar.zst |
Extract query key roots to constants (#3404)
* Extract query key roots to constants * Dedupe labelers-detailed-info * Align naming
Diffstat (limited to 'src/state/queries/search-posts.ts')
-rw-r--r-- | src/state/queries/search-posts.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/state/queries/search-posts.ts b/src/state/queries/search-posts.ts index e0b317ca9..9bf3c0f9e 100644 --- a/src/state/queries/search-posts.ts +++ b/src/state/queries/search-posts.ts @@ -1,16 +1,17 @@ import {AppBskyFeedDefs, AppBskyFeedSearchPosts} from '@atproto/api' import { - useInfiniteQuery, InfiniteData, - QueryKey, QueryClient, + QueryKey, + useInfiniteQuery, } from '@tanstack/react-query' import {getAgent} from '#/state/session' import {embedViewRecordToPostView, getEmbeddedPost} from './util' +const searchPostsQueryKeyRoot = 'search-posts' const searchPostsQueryKey = ({query}: {query: string}) => [ - 'search-posts', + searchPostsQueryKeyRoot, query, ] @@ -43,7 +44,7 @@ export function* findAllPostsInQueryData( const queryDatas = queryClient.getQueriesData< InfiniteData<AppBskyFeedSearchPosts.OutputSchema> >({ - queryKey: ['search-posts'], + queryKey: [searchPostsQueryKeyRoot], }) for (const [_queryKey, queryData] of queryDatas) { if (!queryData?.pages) { |