( filters: MutationFilters, mutation: Mutation<any, any>, )
| 235 | * ``` |
| 236 | */ |
| 237 | export function matchMutation( |
| 238 | filters: MutationFilters, |
| 239 | mutation: Mutation<any, any>, |
| 240 | ): boolean { |
| 241 | const { exact, status, predicate, mutationKey } = filters |
| 242 | if (mutationKey) { |
| 243 | if (!mutation.options.mutationKey) { |
| 244 | return false |
| 245 | } |
| 246 | if (exact) { |
| 247 | if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) { |
| 248 | return false |
| 249 | } |
| 250 | } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) { |
| 251 | return false |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | if (status && mutation.state.status !== status) { |
| 256 | return false |
| 257 | } |
| 258 | |
| 259 | if (predicate && !predicate(mutation)) { |
| 260 | return false |
| 261 | } |
| 262 | |
| 263 | return true |
| 264 | } |
| 265 | |
| 266 | export function hashQueryKeyByOptions<TQueryKey extends QueryKey = QueryKey>( |
| 267 | queryKey: TQueryKey, |
no test coverage detected