Aggregators

  • Opposite of splitters

  • Combines multiple actions back down to one

  • Useful when flow needs to wait for actions to complete before next step

// Effect aggregators
@Effect()
aggregator = this.actions$.pipe(
ofType<LoadUserById>(UserActionTypes.LoadUserById),
flatMap(a =>
zip(
this.actions$.pipe(
ofType<LoadUserByIdSuccess>(UserActionTypes.LoadUserByIdSuccess),
first(t => t.payload.id === a.payload.id)
),
this.actions$.pipe(
ofType<Logged>(LogActionTypes.Logged),
first(t => t.payload.id === a.payload.id)
)
)
),
map(pair => new LoadAdminUserSuccess())
);