You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This took some research to track down, but I'm pretty sure the moutdeepMixin functionality has a flaw when copying nested objects. It's in this function here:
In this function, this is the target object, and val is coming from the source object. The issue is that it only recursively processes nested objects if the key already exists on the target object. Otherwise, it simply stores a reference.
So what happens is the previousAttributes object is actually made of references to nested children. So, if you update a value on that nested child, it won't see it as a change (because the nested object is a literal reference).
I don't know if the right fix is to fix it on mout, which could have adverse affects for anyone using the library, or replace deepMixin with the existing angular.copy function, which already performs the required action without the extra dependency.
Edit: There is one difference between the functions, angular.copy only copies one item onto one destination, while deepMixin accepts multiple objects, if that matters.
The text was updated successfully, but these errors were encountered:
This took some research to track down, but I'm pretty sure the
mout
deepMixin
functionality has a flaw when copying nested objects. It's in this function here:In this function,
this
is the target object, andval
is coming from the source object. The issue is that it only recursively processes nested objects if the key already exists on the target object. Otherwise, it simply stores a reference.So what happens is the
previousAttributes
object is actually made of references to nested children. So, if you update a value on that nested child, it won't see it as a change (because the nested object is a literal reference).I don't know if the right fix is to fix it on
mout
, which could have adverse affects for anyone using the library, or replacedeepMixin
with the existingangular.copy
function, which already performs the required action without the extra dependency.Edit: There is one difference between the functions, angular.copy only copies one item onto one destination, while
deepMixin
accepts multiple objects, if that matters.The text was updated successfully, but these errors were encountered: