You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For this state, I have an ActionReducerMap passed in StoreModule.forRoot in AppModule: export const reducers: ActionReducerMap<IAppState> = { locations: fromLocations.reducer }; export function reducer(state: ILocationsState | undefined, action: Action) { return locationsReducer(state, action); }
I set up ngrx-store-localstorage like this: export function localStorageSyncReducer(reducer: ActionReducer<any>): ActionReducer<any> { return localStorageSync({ keys: ['state'], rehydrate: true })(reducer); }
Now in my localStorage I have a key 'state' whose value is a JSON object of the expected format.
When my app starts, the state is properly recovered from localStorage but it is put under "state" in my store, giving something like this: { state: { locations: { searchLocations: [DATA FROM LOCALSTORAGE] editLocation: {DATA FROM LOCALSTORAGE} } }, locations: { searchLocations: [EMPTY], editLocation: {null} } }
I don't understand why the object recovered from localStorage isn't set as the root level of my store.
The text was updated successfully, but these errors were encountered:
I have an app where the state is shaped like this;
{ locations: { searchLocations: [...] editLocation: {...} } }
For this state, I have an ActionReducerMap passed in StoreModule.forRoot in AppModule:
export const reducers: ActionReducerMap<IAppState> = { locations: fromLocations.reducer };
export function reducer(state: ILocationsState | undefined, action: Action) { return locationsReducer(state, action); }
I set up ngrx-store-localstorage like this:
export function localStorageSyncReducer(reducer: ActionReducer<any>): ActionReducer<any> { return localStorageSync({ keys: ['state'], rehydrate: true })(reducer); }
Now in my localStorage I have a key 'state' whose value is a JSON object of the expected format.
When my app starts, the state is properly recovered from localStorage but it is put under "state" in my store, giving something like this:
{ state: { locations: { searchLocations: [DATA FROM LOCALSTORAGE] editLocation: {DATA FROM LOCALSTORAGE} } }, locations: { searchLocations: [EMPTY], editLocation: {null} } }
I don't understand why the object recovered from localStorage isn't set as the root level of my store.
The text was updated successfully, but these errors were encountered: