(queryKey: QueryKey | MutationKey)
| 230 | * Hashes the value into a stable hash. |
| 231 | */ |
| 232 | export function hashKey(queryKey: QueryKey | MutationKey): string { |
| 233 | return JSON.stringify(queryKey, (_, val) => |
| 234 | isPlainObject(val) |
| 235 | ? Object.keys(val) |
| 236 | .sort() |
| 237 | .reduce((result, key) => { |
| 238 | result[key] = val[key] |
| 239 | return result |
| 240 | }, {} as any) |
| 241 | : val, |
| 242 | ) |
| 243 | } |
| 244 | |
| 245 | /** |
| 246 | * Checks if key `b` partially matches with key `a`. |