( filters: MutationFilters, mutation: Mutation<any, any>, )
| 267 | * ``` |
| 268 | */ |
| 269 | export function matchMutation( |
| 270 | filters: MutationFilters, |
| 271 | mutation: Mutation<any, any>, |
| 272 | ): boolean { |
| 273 | const { exact, status, predicate, mutationKey } = filters |
| 274 | if (mutationKey) { |
| 275 | if (!mutation.options.mutationKey) { |
| 276 | return false |
| 277 | } |
| 278 | if (exact) { |
| 279 | if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) { |
| 280 | return false |
| 281 | } |
| 282 | } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) { |
| 283 | return false |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | if (status && mutation.state.status !== status) { |
| 288 | return false |
| 289 | } |
| 290 | |
| 291 | if (predicate && !predicate(mutation)) { |
| 292 | return false |
| 293 | } |
| 294 | |
| 295 | return true |
| 296 | } |
| 297 | |
| 298 | /** |
| 299 | * Hashes a query key with the query's `queryKeyHashFn` option, falling back to {@link hashKey}. |
no test coverage detected