Ngrx meta-reducer in featureModule handle action of all featureModule

Viewed 405

I'm using @ngrx since some time now and came accross an issue with meta-reducers.

I implemented a meta-reducer for one of my featureModule inside which I just do a console.log of the action/state.

When launching the application I saw that actions of the others featureModule (ex: routerStore => type: "@ngrx/router-store/navigation") where also appearing inside my meta-reducer, I was expecting to only see action of my specific featureModule.

Is this the intended behavior ?

Thank you for your help !

2 Answers

An action is send to all meta-reducers, reducers, and effects. This is the intended behavior.

It's perfectly fine to handle an action inside multiple reducers (even when they're registered in multiple features)

Yes. That's intended behavior because router store is config for whole of your application. The router store module have seperate store for router navigation event inside your app.

Related