about summary refs log tree commit diff
path: root/src/state/queries/post-reposted-by.ts
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-04-04 18:57:38 +0100
committerGitHub <noreply@github.com>2024-04-04 18:57:38 +0100
commitb783745b2e4c1b4c3b55892ba05280808e5b370d (patch)
tree5c3fc20b51496d32934d250186c249de9bf7f515 /src/state/queries/post-reposted-by.ts
parentb26abf212efc0e50bf85a74d15bf7b5ce350cf5a (diff)
downloadvoidsky-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/post-reposted-by.ts')
-rw-r--r--src/state/queries/post-reposted-by.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/state/queries/post-reposted-by.ts b/src/state/queries/post-reposted-by.ts
index db5fa6514..f8cfff0d2 100644
--- a/src/state/queries/post-reposted-by.ts
+++ b/src/state/queries/post-reposted-by.ts
@@ -1,9 +1,9 @@
 import {AppBskyActorDefs, AppBskyFeedGetRepostedBy} from '@atproto/api'
 import {
-  useInfiniteQuery,
   InfiniteData,
   QueryClient,
   QueryKey,
+  useInfiniteQuery,
 } from '@tanstack/react-query'
 
 import {getAgent} from '#/state/session'
@@ -12,7 +12,8 @@ const PAGE_SIZE = 30
 type RQPageParam = string | undefined
 
 // TODO refactor invalidate on mutate?
-export const RQKEY = (resolvedUri: string) => ['post-reposted-by', resolvedUri]
+const RQKEY_ROOT = 'post-reposted-by'
+export const RQKEY = (resolvedUri: string) => [RQKEY_ROOT, resolvedUri]
 
 export function usePostRepostedByQuery(resolvedUri: string | undefined) {
   return useInfiniteQuery<
@@ -44,7 +45,7 @@ export function* findAllProfilesInQueryData(
   const queryDatas = queryClient.getQueriesData<
     InfiniteData<AppBskyFeedGetRepostedBy.OutputSchema>
   >({
-    queryKey: ['post-reposted-by'],
+    queryKey: [RQKEY_ROOT],
   })
   for (const [_queryKey, queryData] of queryDatas) {
     if (!queryData?.pages) {