2017-04-04 93 views
0

经过一些简单的应用程序更改后,我的ngrx商店突然无法正确加载。正如你在下面的屏幕截图中看到的,我获得了大部分商店属性,甚至通过它们的缩减器加载了我的api结果,但我缺少1个临界状态属性uiStatengrx商店突然没有加载状态属性和它的减速器(角度Cli)

我已经取消了我的微小更改并重新启动了浏览器,终端,清除了缓存和本地存储并重新启动了我的计算机,但我的uiState没有被添加到我的商店,并且它的缩放程序从未被调用过。这可能是和Angular Cli或Webpack内存有关吗?如果是这样,我怎么能清除内存?

enter image description here

这是我的状态应该是什么样子:

export interface AppState { 
    uiState: UIState; 
    foodStaging: $DietEntryMap; 
    recipeBuilder: RecipeBuilder; 
    dbData: MongoData; 
} 

而且这里是我撰写我的减速器:

const reducers = { 
    uiState: uiStateReducer, 
    recipeBuilder: recipeReducer, 
    foodStaging: stagingReducer, 
    dbData: dbDataReducer 
}; 

const developmentReducer: ActionReducer<AppState> = 
    compose(
    storeFreeze, 
    storeLogger(loggerOptions), 
    localStorageSync(['dbData'], true), 
    combineReducers) 
    (reducers); 

const productionReducer: ActionReducer<AppState> = 
    compose(localStorageSync(['dbData']), combineReducers)(reducers); 

export function storeReducer(state: AppState, action: any) { 
    if (environment.production) return productionReducer(state, action); 
    else return developmentReducer(state, action); 
} 

而且我UiState减速看起来是这样的:

export function uiStateReducer(state: UIState = INITIAL_UI_STATE, action: UiActions): UIState { 
    switch (action.type) { 
    // action handlers 
    } 
} 

INITIAL_UI_STATE有效

回答

1

当我试图从reducer文件通过桶导入辅助函数到效果服务时,出现了一些问题。我只是将整个功能移到效果上,一切都奏效。