Root reducers shown empty when StoreRouterConnectingModule used

Viewed 235

I'm trying StoreRouterConnectingModule on my project to understand how it works. But when I import that module to my app module, my reducers shown as empty objects.

In the other hand if I send dummy callback as reducer like () => ({test: 'test'}). Reducer shown filled.

What am I missing here?

inside of app module

imports: [
    StoreModule.forRoot(reducers, { metaReducers }),
    EffectsModule.forRoot([RootEffects]),
    StoreRouterConnectingModule.forRoot({ stateKey: 'router' }),
    StoreDevtoolsModule.instrument(),
]

root reducers

export const reducers: ActionReducerMap<AppState> = {
    router: routerReducer,
    root: fromRoot.rootReducer
}

root reducer

export const rootReducer = (state = initialState, action: RootActions.RootActions): RootState => {
    switch (action.type) {
        case RootActionTypes.Action1:
            return {...state} // push action1 items
        case RootActionTypes.Action2:
            return {...state} // push action2 items
        case RootActionTypes.Action3:
            return {...state} // push action3 items
        default:
            return state;
    }
};

The Solution

In my case problem caused because I was using metronic angular theme and there was a mistake made by keen themes team.

The problem is that metronic angular use StoreFreeze module which is deprecated and cause some problems with StoreRouterModule since ngrx@4

I removed and enable strictStateImmutability which is ngrx supports natively for some years..

0 Answers
Related