-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Multipart state persistance mechanism #51
Comments
This is definitely a good idea. I will take a look into seeing if this can be implemented easily. |
This should be a priority. I never done an app with redux that contained only primitives. All my app states point to different custom objects. |
@ciokan I'm not sure if you understand this issue. The OP only wants to save difference portions of his state to different files. You can serialize anything using this package. Your toJson method can return any data |
Oh. I thought that this plugin does not work work for state that is a bit nested. |
It works very well for that. You can just call the nested object's toJson in your main toJson. If you have any other questions, feel free to open another ticket to keep this one on topic! |
Hi @Cretezy! Multipart state is a great idea. It slows the apps down quite a bit having to serialize everything with every action, especially if you have a large state object, of which a large part of the information does not change regularly. Let me know if you need any help. Kind regards, Ian |
Sorry I haven't had a lot of time to work on this. Due to how JSON is, it's all or nothing. I will try to come up for a way to have multiple save locations per key. If you are storing a very large amount of data, I would highly suggest you use a hybrid approach and use a SQLite database as your storage mechanism instead of redux_persist, and load data dynamically. I've used this in one of my apps to a great success, but since it's more effort to implement, I would only suggest it for when you see performance issues with your app, or know you'll store a ton of data (100s of MBs or GBs) |
Can you share an implementation for how you achieved this |
I would like to have ability to manage persistance for specific part of AppState.
Examle:
persist userState to "UserState.json" file, and don't save it if it wasn't changed.
persist offerState to "OfferSate.json" file, and don't save it if it wasn't changed.
and don't persist otherDataState
Workarround:
Now I need to split my state to multiple independent state objects.
Hope you will implement better possibilities for my case.
The text was updated successfully, but these errors were encountered: