Skip to content

Ngrx/entity and metaReducers with localStorageSync #1464

@csaszika

Description

@csaszika

Hi Everyone,

I just would like to ask that it is possible to use ngrx/entity with localStorageSync?

My experience is that everything is working with normal states but with entity states no.

This is an example how I would like to register my entity state into local storage.

export function userPreferencesLocalStorageSyncReducer(reducer: ActionReducer<any>): ActionReducer<any> {
  return localStorageSync({
    keys: [USER_PREFERENCES_STORE_KEY],
    rehydrate: true,
  })(reducer);
}

@NgModule({
  imports: [StoreModule.forFeature(USER_PREFERENCES_STORE_KEY, reducer, { initialState, metaReducers })],
})
export class UserPreferencesStoreModule {}

Thanks for any advice

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions