Open EugeneSnihovsky opened 5 years ago
Came up with this, seems to work
export function stateSetter(reducer: ActionReducer<any>): ActionReducer<any> {
return function (state: any, action: any) {
const NGRX_STATE = '___NGRX_STATE___';
const newState = reducer(state, action);
if (action.type !== '@ngrx/store/init') {
return window[NGRX_STATE] = newState;
} else {
if (window[NGRX_STATE]) {
return window[NGRX_STATE];
}
return newState;
}
};
}
export const metaReducers: MetaReducer<State>[] = !environment.production ? [storeFreeze, stateSetter] : [];
Hello. I spend about half of day and still can't get positive result. State data is not saved after reload. Please provide normal example of usage.
I already tried: