2017-04-04 94 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文件通過桶導入輔助函數到效果服務時,出現了一些問題。我只是將整個功能移到效果上,一切都奏效。