The conversion can go either to the effect or to the gearbox.
If there was any check that was supposed to be done, I would put it into action - where I would have the opportunity to send an error message.
Otherwise, I would put it in the reducer, since where I usually converted the action payload to state.
There is another option: you can use the selector. That is, messages can be stored in state as a simple array, and the selector can be used to convert status messages, group them by counterparty - or something else. If I had several ways to group messages, this is the option I would choose.
@ngrx/example-app contains several sample selectors :
/** * A selector function is a map function factory. We pass it parameters and it * returns a function that maps from the larger state tree into a smaller * piece of state. This selector simply selects the `books` state. * * Selectors are used with the `select` operator. * * ```ts * class MyComponent { * constructor(state$: Observable<State>) { * this.booksState$ = state$.select(getBooksState); * } * } * ``` */ export const getBooksState = (state: State) => state.books
cartant
source share