0
votes

I have an angular 6 application and i'm using ngrx to manage state. And i noticed that an action sent that is caught by the ngrx Effects, is still going to the reducer. Am i doing something wrong or it's just normal ? Shouldn't the action stop propagating when caught by the Effects ?

1
Reducers are used to propagate a new state. Effects are used to handle side effects. They don't have the same purpose, so I would say that this is normal. But I'm just a beginner, so it's more of an opinion than a fact.user4676340

1 Answers

1
votes

Generally

Yes. More specifically all actions hit all reducers first, then the action is passed to the effects.

Find the reference here.

Proposal

I think you should have separate actions for these. Create actions which are going to trigger effects, and create actions which are going to change state in reducer.

Mixing these is not a good approach.

Check out how ngrx sample application handle these.