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
I am trying to figure out how to create a custom prefix based on a siteId which is stored in the AppState. Could you help me out in providing the siteId of the AppState in the localStorageSyncReducer of a StoreModule.forFeature('x')?
exportfunctionlocalStorageSyncReducer(reducer: ActionReducer<ReadMappingState>): ActionReducer<ReadMappingState>{constsiteId: string='this must be a dynamic siteId based on the site in AppState';returnlocalStorageSync({keys: STORE_KEYS_TO_PERSIST,storageKeySerializer: (key)=>`${siteId}_${key}`,rehydrate: true,removeOnUndefined: true,
mergeReducer
})(reducer);}
Okay I managed to get the id in an action and save it in the localStorage based on which site is selected with the siteId prefix, but there are two problems:
Both states will be overwritten with data.
Rehydrating of a specific state based on the siteId is not working.
I am trying to figure out how to create a custom prefix based on a siteId which is stored in the AppState. Could you help me out in providing the siteId of the AppState in the localStorageSyncReducer of a StoreModule.forFeature('x')?
This is the state module of feature X:
Would be nice if somebody could help me out :)
The text was updated successfully, but these errors were encountered: