* Collects the mutations in the cache that match `options.filters`, mapped with `options.select` * (or to their state, by default). * @param mutationCache - The mutation cache to read. * @param options - The `filters` to match and the `select` function to map each mutation with. * @returns The s
( mutationCache: MutationCache, options: MutationStateOptions<TResult, TMutation>, )
| 38 | * @returns The selected value of every matching mutation. |
| 39 | */ |
| 40 | function getResult< |
| 41 | TResult = MutationState, |
| 42 | TMutation extends Mutation<any, any, any, any> = |
| 43 | MutationTypeFromResult<TResult>, |
| 44 | >( |
| 45 | mutationCache: MutationCache, |
| 46 | options: MutationStateOptions<TResult, TMutation>, |
| 47 | ): Array<TResult> { |
| 48 | return mutationCache |
| 49 | .findAll(options.filters) |
| 50 | .map( |
| 51 | (mutation): TResult => |
| 52 | (options.select |
| 53 | ? options.select(mutation as TMutation) |
| 54 | : mutation.state) as TResult, |
| 55 | ) |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * `useMutationState` is a primitive that gives you access to all mutations in the `MutationCache`. You can pass |
no test coverage detected