-
Notifications
You must be signed in to change notification settings - Fork 217
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
Merging objects discards target class information #208
Comments
So you want a deep assign merge, rather than a deep clone merge? |
Exactly right. 👍 |
Wouldn't this me a dup of #186 |
If I'm understanding it correctly, the Josh's comment on your linked issue summarizes it well, I think. The ask would be to allow |
Yeah, exactly what @creativeux said – the fix here would be to make the I would be open to a pull request that implemented that |
@TehShrike - Ask and ye shall receive. Thank you for the quick discussion and feedback on the ask! |
For my use case, I am deserializing JSON to ES6 classes to assist in control flow and developer experience. I am using
deepmerge
to update objects stored in Easy Peasy, and I noticed that merging is causing the class information to be discarded, which is breaking my downstream use ofinstanceof
for control flow purposes as well as likely confusing Easy Peasy / immer with new memory pointers for objects in state.Specifically, this is where the issue lies in
mergeObject
:☝️ If I change this to assign the value of
target
todestination
it works as I expect it to, but breaks other use cases.I added the following unit test to show the behavior I expect, and it fails as I described above.
Is this something that would be considered for support in the future?
The text was updated successfully, but these errors were encountered: