( filters: MutationFilters, mutation: Mutation<any, any>, )
| 189 | } |
| 190 | |
| 191 | export function matchMutation( |
| 192 | filters: MutationFilters, |
| 193 | mutation: Mutation<any, any>, |
| 194 | ): boolean { |
| 195 | const { exact, status, predicate, mutationKey } = filters |
| 196 | if (mutationKey) { |
| 197 | if (!mutation.options.mutationKey) { |
| 198 | return false |
| 199 | } |
| 200 | if (exact) { |
| 201 | if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) { |
| 202 | return false |
| 203 | } |
| 204 | } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) { |
| 205 | return false |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | if (status && mutation.state.status !== status) { |
| 210 | return false |
| 211 | } |
| 212 | |
| 213 | if (predicate && !predicate(mutation)) { |
| 214 | return false |
| 215 | } |
| 216 | |
| 217 | return true |
| 218 | } |
| 219 | |
| 220 | export function hashQueryKeyByOptions<TQueryKey extends QueryKey = QueryKey>( |
| 221 | queryKey: TQueryKey, |
no test coverage detected