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

Function hashKey

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

Source from the content-addressed store, hash-verified

282 * ```
283 */
284export function hashKey(queryKey: QueryKey | MutationKey): string {
285 return JSON.stringify(queryKey, (_, val) =>
286 isPlainObject(val)
287 ? Object.keys(val)
288 .sort()
289 .reduce((result, key) => {
290 result[key] = val[key]
291 return result
292 }, {} as any)
293 : val,
294 )
295}
296
297/**
298 * 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