(queryKey: QueryKey | MutationKey)
| 221 | * Hashes the value into a stable hash. |
| 222 | */ |
| 223 | export function hashKey(queryKey: QueryKey | MutationKey): string { |
| 224 | return JSON.stringify(queryKey, (_, val) => |
| 225 | isPlainObject(val) |
| 226 | ? Object.keys(val) |
| 227 | .sort() |
| 228 | .reduce((result, key) => { |
| 229 | result[key] = val[key] |
| 230 | return result |
| 231 | }, {} as any) |
| 232 | : val, |
| 233 | ) |
| 234 | } |
| 235 | |
| 236 | /** |
| 237 | * Checks if key `b` partially matches with key `a`. |