MCPcopy Create free account
hub / github.com/TanStack/query / hashQueryKeyByOptions

Function hashQueryKeyByOptions

packages/query-core/src/utils.ts:304–310  ·  view source on GitHub ↗
(
  queryKey: TQueryKey,
  options?: Pick<QueryOptions<any, any, any, any>, 'queryKeyHashFn'>,
)

Source from the content-addressed store, hash-verified

302 * @returns The query hash, a string that identifies the query in the cache.
303 */
304export function hashQueryKeyByOptions<TQueryKey extends QueryKey = QueryKey>(
305 queryKey: TQueryKey,
306 options?: Pick<QueryOptions<any, any, any, any>, 'queryKeyHashFn'>,
307): string {
308 const hashFn = options?.queryKeyHashFn || hashKey
309 return hashFn(queryKey)
310}
311
312/**
313 * Default query & mutation keys hash function.

Callers 6

defaultQueryOptionsMethod · 0.90
buildMethod · 0.90
utils.test-d.tsxFile · 0.90
utils.test.tsxFile · 0.90
query.test.tsxFile · 0.90
matchQueryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected