sindresorhus/on-change

An Object's onChange function does not get called when a property is set from another object's setter function

ChuckFields opened this issue · 3 comments

I have a parent and child object that are setup to be watched separately. In the parent object, I have a getter and setter to expose access to a property on the child. I've noticed that the onChange function does not get called for the child object when calling the setter on the parent object. I've set up a basic example to reproduce this problem here.

Can you provide a code sample?

The child object is not proxied. Change obj.child = child; to obj.child = watchedChild; and move it after you create watchedChild.