Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable data retention for ngrx store slices #720

Merged
merged 1 commit into from
Jun 11, 2021

Conversation

dhhyi
Copy link
Collaborator

@dhhyi dhhyi commented Jun 4, 2021

PR Type

[x] Feature

What Is the Current Behavior?

Data for recently or compare does not persist beyond the application lifetime, which even ends after a page refresh. This makes it hard to customize these features, as the ng serve also resets the store on every save.

It is possible to persist the data with localStorageSaveMeta, but this meta reducer does not save the data in accordance with the deploy baseHref, which basically breaks this feature in a multi-channel deployment with context path support.

What Is the New Behavior?

Stores for recently, compare and tacton can be saved to session or local storage respecting the scope given by the baseHref. No new defaults are configured with this PR, the application will behave like previously. It is now possible for project customizations to enable data persistence for these stores. The configuration can be supplied as compile time property in environment.ts files.

Does this PR Introduce a Breaking Change?

[ ] Yes
[x] No

Other Information

@dhhyi dhhyi self-assigned this Jun 4, 2021
@dhhyi dhhyi added the enhancement Enhancement to an existing feature label Jun 4, 2021
@dhhyi dhhyi force-pushed the feature/data-retention branch from af49d04 to 71fb2d1 Compare June 4, 2021 21:08
@dhhyi dhhyi requested a review from shauke June 7, 2021 07:57
@dhhyi dhhyi removed their assignment Jun 7, 2021
@dhhyi dhhyi marked this pull request as ready for review June 7, 2021 07:57
@shauke shauke requested a review from suschneider June 7, 2021 13:44
@shauke shauke added this to the 0.32 milestone Jun 7, 2021
@dhhyi dhhyi force-pushed the feature/data-retention branch from 71fb2d1 to f44932e Compare June 10, 2021 13:37
suschneider
suschneider previously approved these changes Jun 11, 2021
@shauke shauke merged commit 3f0069e into develop Jun 11, 2021
@shauke shauke deleted the feature/data-retention branch June 11, 2021 13:56
@shauke
Copy link
Collaborator

shauke commented Jun 14, 2021

@dhhyi Thank you for the nice feature. I merged it with whole data retention possibilities enabled by default to profit from the improvements and to showcase it in all places.

default configuration in environment.model.ts

  dataRetention: {
    compare: 'session',
    recently: 60 * 24 * 7, // 1 week
    tacton: 'forever',
  },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants