Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Add Store Hydration/Serialization API #856

Closed
MikeRyanDev opened this issue Feb 25, 2018 · 13 comments
Closed

Add Store Hydration/Serialization API #856

MikeRyanDev opened this issue Feb 25, 2018 · 13 comments

Comments

@MikeRyanDev
Copy link
Member

MikeRyanDev commented Feb 25, 2018

To better support state serialization and hydration I recommend adding built-in APIs into @ngrx/store. We should try and tackle the two biggest use cases:

  • Serializing state for server side rendering
  • Persisting state in browser and native platform storage

Ideally, we would separate the process of persistence and serialization into two steps:

  1. Transform - Take a state object and perform a transformation on it
  2. Store - Take the transformed result and save it

This would allow authors of persistence strategies to focus on persistence without having to reimplement key filtering or Immutable restructuring.

@MattiJarvinen
Copy link

Remember handling async storage in saving to indexedDB or some native cordova plugin filesystem etc.

@Matmo10
Copy link

Matmo10 commented May 23, 2018

Just throwing out ideas while we're on the topic ... but it would be awesome if something like https://github.com/btroncone/ngrx-store-localstorage became a first class part of ngrx itself. Serializing out for SSR and indexedDB usage is definitely important too, but I would guess that the majority of people are just saving bits of state to localstorage. Plus, the library above doesn't work with feature modules.

@brandonroberts brandonroberts added 8.x and removed 7.x labels Dec 20, 2018
@Dutchboy
Copy link

.... When is this going to be implemented? :-( Wasn't it for 7.0?? (today....)

@brandonroberts brandonroberts removed the 8.x label Apr 1, 2019
@Dutchboy
Copy link

@brandonroberts When do you think it is going to work?

@itayod
Copy link
Contributor

itayod commented Jun 23, 2019

@brandonroberts may I take this?

@brandonroberts
Copy link
Member

@Dutchboy @itayod we're going to put together a design for this first, which we have on our list to look at since version 8 has launched.

@itayod
Copy link
Contributor

itayod commented Jun 24, 2019

@brandonroberts sounds great!
meanwhile, I have posted a blog that might help users to implement it:
https://medium.com/better-programming/sync-your-state-in-local-storage-with-ngrx-9d6ceba93fc0

@biesbjerg
Copy link

I'm using ngrx-store-sync that I hacked together. Seems to work for my use case.

Putting it here to maybe give you some ideas how to do it (or not do it :D)

@rickvandermey
Copy link

@itayod maybe update your article and repo to 8, because of breaking changes in meta reducer

@itayod
Copy link
Contributor

itayod commented Jun 24, 2019

@rickvandermey Thanks for noticing me! but I think most of the users are still on version 7.X. so I guess update it now could lead to some confusion at this point :)

@LAlves91
Copy link

Any news on this one?

@classifieds-dev
Copy link

Is there any more news? What have you done to contribute.

@LAlves91
Copy link

@classifieds-dev relax man! I was just asking!

@ngrx ngrx locked and limited conversation to collaborators Jul 20, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

11 participants