无法使用Redux DevTools从json导入延迟加载的模块状态

时间:2018-09-07 10:18:51

标签: angular redux ngrx ngrx-store redux-devtools

我正在使用Angular和ngrx和redux DevTools for Chrome开发应用程序。 我的应用程序还有一个延迟加载的模块,我将其配置如下:

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

这是我的减速器索引文件:

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);

使用此配置,一切正常,但是我注意到,当我使用ReduxDevTools导出应用程序的状态(作为json)时,然后我重新上传了惰性模块的状态。它保持为空。

如果我在懒惰模块的状态下立即启动应用程序,然后导入json,则可以正常工作,但是如果我从应用程序的开头启动,则可以使用时间滑块导入json。 ,当我到达惰性模块时,状态为null(默认)。

我是在做错什么还是问题,当我进入惰性模块时,它会覆盖json的状态吗?

非常感谢

0 个答案:

没有答案