0

I'm developing an application using Angular and ngrx with redux DevTools for Chrome. My application has also a lazy-loaded module and I configured it like this:

@NgModule({
    imports: [
        CommonModule,
        FormsModule,
        RouterModule.forChild([
            { path: '', component: UserLazyHistoryComponent }
        ]),
        StoreModule.forFeature(moduleFeatureName, reducers),
        EffectsModule.forFeature([
            HistoryEffects
        ])
    ],
    declarations: [UserLazyHistoryComponent]
})
export class UserLazyHistoryModule { }

and this is my reducer index file:

export const moduleFeatureName = 'user-lazy-module';

export interface UserLazySate {
    history: fromHistory.HistoryState;
}

export const reducers = {
    history: fromHistory.reducer
};

export const selectHistoryModuleState = createFeatureSelector<UserLazySate>(moduleFeatureName);

export const selectHistory = createSelector(selectHistoryModuleState, s => s.history);

With this configuration everything works well but I noticed that when I export the state of the application (as a json) using the ReduxDevTools and than I reupload it the state of the lazy module is not loaded. It remains null.

If I start the application right in that state of the lazy-laoded module and then I import the json, it works, but if I start from the beginning of the app, then I import the json, using the time-slider, when I reach the lazy module the state is null (default).

Am I doing something wrong or the problem is that when I enter the lazy module it overrides the state of the json?

Thanks a lot

user3471528
  • 3,013
  • 6
  • 36
  • 60

0 Answers0