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

Function hashKey

packages/query-core/src/utils.ts:323–334  ·  view source on GitHub ↗
(queryKey: QueryKey | MutationKey)

Source from the content-addressed store, hash-verified

321 * ```
322 */
323export function hashKey(queryKey: QueryKey | MutationKey): string {
324 return JSON.stringify(queryKey, (_, val) =>
325 isPlainObject(val)
326 ? Object.keys(val)
327 .sort()
328 .reduce((result, key) => {
329 result[key] = val[key]
330 return result
331 }, {} as any)
332 : val,
333 )
334}
335
336/**
337 * Checks if key `b` partially matches with key `a`.

Callers 12

restoreQueriesFunction · 0.90
removeQueriesFunction · 0.90
setupPersisterFunction · 0.90
setQueryDefaultsMethod · 0.90
setMutationDefaultsMethod · 0.90
setOptionsMethod · 0.90
utils.test-d.tsxFile · 0.90
utils.test.tsxFile · 0.90
matchMutationFunction · 0.85

Calls 1

isPlainObjectFunction · 0.70

Tested by 1

setupPersisterFunction · 0.72