Skip to content
Advertisement

Can’t reinizialize ngrx’s state’s feature

I’m working with ngrx and this is my initialState:

JavaScript

i need reinitialize the state feature. This is my reducer’s case:

JavaScript

I’m expecting that this reducer, clean my feature state, returning it equal to the initialState.

But the state dosen’t change. If i log the initialState, it is equal to the actual state

The only way I can reset it is doing this before the reducer inizialization

JavaScript

and then

JavaScript

I’m using the metareducer to clear all the state, and it is working well. but in this case i need to clear only this slice of state. i’m struggling on this from a while.

Advertisement

Answer

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement