-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Partialize for Nested Objects in Zundo #170
Comments
Any workaround to do this ? @charkour ? |
Hi @astrarudra, Thank you so much for the kind words and thank you for your patience. Unfortunately, it's not possible to partialize a nested object and I don't think there's a way to change the code to support this. However, here is a workaround to try. Create a setter in the zustand store that splits Hope this helps! |
I'll take a look at adding a |
Thanks! |
Thanks! I did take a look at the zundo code and decided it's likely best to make a middleware to handle how states are merged rather than update zundo itself. |
hi is there an example of what to do here? i dont care for changes in all of my object properties, only some of them |
First and foremost, I would like to express my appreciation for the incredible work you have done with Zundo. It has proven to be an invaluable tool for managing state and implementing undo/redo functionality in Zustand-powered applications.
I am reaching out to raise an issue I've encountered while using Zundo in conjunction with Zustand, particularly concerning the handling of nested objects within the store during undo and redo operations.
In my application's store, I have a structure that includes multiple properties, among which are nested, simple1, and simple2. While implementing undo and redo functionality, I have utilized the partialize function to specify which properties should be considered for linking to undo and redo actions. However, I have encountered a challenge specifically with the nested object.
The nested object contains several properties, such as nestedProp1, nestedProp2, nestedProp3, and nestedProp4. However, for undo and redo operations, I am only interested in tracking changes to nestedProp1 and nestedProp2. Unfortunately, the current implementation of partialize does not provide a straightforward way to achieve this level of granularity.
Is there a way to achieve this?
Here is an example of the current partialize implementation:
partialize: (state) => {
}
The text was updated successfully, but these errors were encountered: