Open AlexVegner opened 5 years ago
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)
I would like to have ability to manage persistance for specific part of AppState. Examle:
class AppState { UserState userState; OfferSate offerState; OtherDataState otherDataState; } class UserState { String id; String fullName; ... } class OfferSate { List<Offers> offerList; ... } class OtherDataState { ... }
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.
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.