* Reads and projects the matching entries in a mutation cache. * @param mutationCache - The cache to inspect. * @param options - Filters and an optional projection for each entry. * @returns The selected values, or each matching mutation state.
( mutationCache: MutationCache, options: MutationStateOptions<TResult, TMutation>, )
| 45 | * @returns The selected values, or each matching mutation state. |
| 46 | */ |
| 47 | function getResult< |
| 48 | TResult = MutationState, |
| 49 | TMutation extends Mutation<any, any, any, any> = |
| 50 | MutationTypeFromResult<TResult>, |
| 51 | >( |
| 52 | mutationCache: MutationCache, |
| 53 | options: MutationStateOptions<TResult, TMutation>, |
| 54 | ): Array<TResult> { |
| 55 | return mutationCache |
| 56 | .findAll(options.filters) |
| 57 | .map( |
| 58 | (mutation): TResult => |
| 59 | (options.select |
| 60 | ? options.select(mutation as TMutation) |
| 61 | : mutation.state) as TResult, |
| 62 | ) |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Injects a signal that gives you access to all mutations in the `MutationCache`. You can pass `filters` |
no test coverage detected