Extract query key roots to constants (#3404)

* Extract query key roots to constants

* Dedupe labelers-detailed-info

* Align naming
This commit is contained in:
dan
2024-04-04 18:57:38 +01:00
committed by GitHub
parent b26abf212e
commit b783745b2e
31 changed files with 202 additions and 143 deletions
+11 -3
View File
@@ -2,17 +2,25 @@ import {AppBskyLabelerDefs} from '@atproto/api'
import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query'
import {z} from 'zod'
import {labelersDetailedInfoQueryKeyRoot} from '#/lib/react-query'
import {STALE} from '#/state/queries'
import {preferencesQueryKey} from '#/state/queries/preferences'
import {getAgent} from '#/state/session'
export const labelerInfoQueryKey = (did: string) => ['labeler-info', did]
const labelerInfoQueryKeyRoot = 'labeler-info'
export const labelerInfoQueryKey = (did: string) => [
labelerInfoQueryKeyRoot,
did,
]
const labelersInfoQueryKeyRoot = 'labelers-info'
export const labelersInfoQueryKey = (dids: string[]) => [
'labelers-info',
labelersInfoQueryKeyRoot,
dids.slice().sort(),
]
export const labelersDetailedInfoQueryKey = (dids: string[]) => [
'labelers-detailed-info',
labelersDetailedInfoQueryKeyRoot,
dids,
]