Mickael B.
Mickael B.

Reputation: 253

Ngrx meta-reducer in featureModule handle action of all featureModule

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 !

Upvotes: 3

Views: 1092

Answers (2)

timdeschryver
timdeschryver

Reputation: 15505

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)

Upvotes: 3

Tony
Tony

Reputation: 20102

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.

Upvotes: 1

Related Questions