Skip to main content

Variable: preprintKeys

const preprintKeys: object

Defined in: web/lib/hooks/use-preprint.ts:26

Query key factory for preprint queries.

Type declaration

all

all: readonly ["preprints"]

Base key for all preprint queries

byAuthor()

byAuthor: (did) => readonly ["preprints", "author", string]

Key for preprints by author

Parameters

did

string

Returns

readonly ["preprints", "author", string]

detail()

detail: (uri) => readonly ["preprints", "detail", string]

Key for specific preprint detail query

Parameters

uri

string

Returns

readonly ["preprints", "detail", string]

details()

details: () => readonly ["preprints", "detail"]

Key for preprint detail queries

Returns

readonly ["preprints", "detail"]

list()

list: (params) => readonly ["preprints", "list", { cursor: string; field: string; limit: number; }]

Key for specific preprint list query with params

Parameters

params
cursor

string

field

string

limit

number

Returns

readonly ["preprints", "list", { cursor: string; field: string; limit: number; }]

lists()

lists: () => readonly ["preprints", "list"]

Key for preprint list queries

Returns

readonly ["preprints", "list"]

Remarks

Follows TanStack Query best practices for cache key management. Enables fine-grained cache invalidation for preprint data.

Example

// Invalidate all preprint queries
queryClient.invalidateQueries({ queryKey: preprintKeys.all });

// Invalidate specific preprint
queryClient.invalidateQueries({ queryKey: preprintKeys.detail('at://did:plc:abc/...') });

// Invalidate all preprints by a specific author
queryClient.invalidateQueries({ queryKey: preprintKeys.byAuthor('did:plc:abc') });