Extract query key roots to constants (#3404)
* Extract query key roots to constants * Dedupe labelers-detailed-info * Align naming
This commit is contained in:
@@ -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,
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user