Variable: endorsementKeys
constendorsementKeys:object
Defined in: web/lib/hooks/use-endorsement.ts:78
Query key factory for endorsement queries.
Type declaration
all
all: readonly [
"endorsements"]
Base key for all endorsement queries
byUser()
byUser: (
did) => readonly ["endorsements","user",string]
Key for endorsements by a specific user
Parameters
did
string
Returns
readonly ["endorsements", "user", string]
forPreprint()
forPreprint: (
preprintUri) => readonly ["endorsements","preprint",string]
Key for endorsements by preprint
Parameters
preprintUri
string
Returns
readonly ["endorsements", "preprint", string]
list()
list: (
preprintUri,params?) => readonly ["endorsements","preprint",string,"list",undefined|EndorsementListParams]
Key for endorsements list with filters
Parameters
preprintUri
string
params?
EndorsementListParams
Returns
readonly ["endorsements", "preprint", string, "list", undefined | EndorsementListParams]
summary()
summary: (
preprintUri) => readonly ["endorsements","preprint",string,"summary"]
Key for endorsement summary (counts by type)
Parameters
preprintUri
string
Returns
readonly ["endorsements", "preprint", string, "summary"]
userEndorsement()
userEndorsement: (
preprintUri,userDid) => readonly ["endorsements","preprint",string,"user",string]
Key for user's endorsement on a preprint
Parameters
preprintUri
string
userDid
string
Returns
readonly ["endorsements", "preprint", string, "user", string]
Remarks
Follows TanStack Query best practices for hierarchical cache key management.
Example
// Invalidate all endorsement queries
queryClient.invalidateQueries({ queryKey: endorsementKeys.all });
// Invalidate endorsements for a specific preprint
queryClient.invalidateQueries({ queryKey: endorsementKeys.forPreprint(preprintUri) });
// Check if user has endorsed
queryClient.getQueryData(endorsementKeys.userEndorsement(preprintUri, userDid));