I'm using the Splitter decider pattern to split out a single action into two actions:
Class TodosEffects{
Constructor(private actions: actions) {}
@Effect()
public todo$: Observable<Action> = this.actions.pipe(
ofType(‘REQUEST_ADD_TODO’),
map(action => action.payload),
flatMap(thing => [
{type: ‘ADD_TODO’, payload: thing},
{type: ‘LOG_OPERATION’, payload: thing}
]);
}
I've taken the code of the Splitter decider pattern and updated it to ngrx 6.
This is pretty close to what I want, but how can I maintain order? With this example, I'd like the ADD_TODO
action to complete, then, call LOG_OPERATION
.
As it is, both actions are dispatched without much control. I like the idea of combining actions in a single Effect()
for code re-use, but without the ability to maintain order this approach is not much help.