Rehydrating lazy loaded feaure modules
nshathish opened this issue · comments
Adolphous Shathish commented
Adolphous Shathish commented
when rehydrating the session storage data to the state, only features modules that are loaded already have their features stores filled in from the session storage
how to rehydrate everything from the session storage into the state ?
Bitcollage commented
1.) You have to make sure rehydrate: true
is set!
export function localStorageSyncReducer(reducer: ActionReducer<any>): ActionReducer<any> {
return localStorageSync({keys: ['someStorageKey'], rehydrate: true})(reducer);
}
2.) Registering localStorageSyncReducer in your root module:
StoreModule.forRoot({}, {
...
...
metaReducers: [localStorageSyncReducer],
}),
``
Gerardo Sebastian Gonzalez commented
we have exactly the same problem