( filters: MutationFilters, mutation: Mutation<any, any>, )
| 180 | } |
| 181 | |
| 182 | export function matchMutation( |
| 183 | filters: MutationFilters, |
| 184 | mutation: Mutation<any, any>, |
| 185 | ): boolean { |
| 186 | const { exact, status, predicate, mutationKey } = filters |
| 187 | if (mutationKey) { |
| 188 | if (!mutation.options.mutationKey) { |
| 189 | return false |
| 190 | } |
| 191 | if (exact) { |
| 192 | if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) { |
| 193 | return false |
| 194 | } |
| 195 | } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) { |
| 196 | return false |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | if (status && mutation.state.status !== status) { |
| 201 | return false |
| 202 | } |
| 203 | |
| 204 | if (predicate && !predicate(mutation)) { |
| 205 | return false |
| 206 | } |
| 207 | |
| 208 | return true |
| 209 | } |
| 210 | |
| 211 | export function hashQueryKeyByOptions<TQueryKey extends QueryKey = QueryKey>( |
| 212 | queryKey: TQueryKey, |
no test coverage detected