на
ngrx.io есть такой пример
https://ngrx.io/guide/store/selectors#advanced-example-select-the-last-n-state-transitionsа в частности вот это
export const selectLastStateTransitions = (count: number) => {
return pipe(
// Thanks to `createSelector` the operator will have memoization "for free"
select(selectProjectedValues),
// Combines the last `count` state values in array
scan((acc, curr) => {
return [ curr, acc[0], acc[1] ].filter(val => val !== undefined);
}, [] as {foo: number; bar: string}[]) // XX: Explicit type hint for the array.
// Equivalent to what is emitted by the selector
);
}можно ли подобное использовать с объединением, примерно так
return pipe(
switchMap(() => forkJoin([
pipe(
select(firstSelector, param),
take(1)
),
pipe(
select(secondSelector),
take(1)
),
pipe(
select(thirdSelector, param),
map((fromSelector) => fromSelector.name),
switchMap((name) => select(otherSelector, name)),
take(1)
)
])
),
map(([firstSelector, secondSelector, thirdSelector]) => {
return {firstSelector, secondSelector, thirdSelector}
})
);