-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
defineProperty should consider that descriptor.value is undefined when calling handleChangeOnTarget #79
Comments
Could you provide a code example of this? |
yes I could, buit I need some time. |
Ah, I think I understand now. I'll see what I can do. |
After thinking about this, I believe onChange is behaving correctly. We intentionally trigger a change when a descriptor changes or is added, even if the value is undefined. We could add an option like ignoreDescriptorChanges that only triggers when the value changes. Does that sound like it would solve your problem? |
Sounds like a solution but the value isn't undefined. It's just hidden under the get method of the descriptor and the value property of the descriptor is missing. So the callback wouldn't fire if this is get noticed. Then you can exchange the propertydescriptor without the need of "value"and give it only a get method while leaving the value of the observed object untouched. I think we don't want to check if a descriptor is changed so the option should sound like observeDescriptorChange. But maybe both is good. |
So its converting a property with a value to a property with getters/setters that returns the same value? If that's the case, then in my opinion that constitutes a change to object. Can you filter these out by comparing the value and previous value? |
No I can't. When VUE changes the propertyDescriptor, the old and the new Value are undefined. |
Hi there again :'D,
currently I am running into a strange Bug in combination with VUE.
VUE defines its own properties on an object but does not define a value on the propertyDescriptor.
on-change's defineProperty (line 132) method is assuming, that this is always set. In my case the "current" value is determined in a wrong way so that it is always undefined at the first time. You should check with
if it is avalable and use descriptor.get() otherwise
maybe it has to be checked earlyer to be sure that there is a change or not.
The text was updated successfully, but these errors were encountered: