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
Declare a computed property on a parent component, with a setter
In a child component, pass the computed property as a v-model
Attempt to update the property via the v-model binding
What is expected?
The computed property setter is called.
What is actually happening?
The computed property setter is not called and the following message appears in the JavaScript console:
[Vue warn]: Avoid adding reactive properties to a Vue instance or its root $data at runtime - declare it upfront in the data option.
This appears to be a regression in Vue 2.5.0, as changing the Vue version in the provided jsFiddle to 2.4.0 fixes the bug. The optimisation applied earlier in the 2.x-series to declare computed properties on the component's prototype appears to interfere with the call to hasOwn in function set (in observer/index).
The text was updated successfully, but these errors were encountered:
I've found a change in parseModel which might be the culprit. Prior to this change, v-model bindings in the form 'foo.bar' would not be rewritten to '$set(foo, 'bar', $$v)'.
I understand. However, my reproducible isn't really reflective of what I'm trying to accomplish.
I have written a simple data grid, which accepts arbitrary Vue template strings to render column contents with. For the header column, I'm rendering a checkbox whose data is to be bound to a computed property on the containing component (the one that instantiates the data grid). This checkbox reflect the selected state of all rows in the grid, and changing should update the underlying selection flags on each of the rows.
I've implemented this by declaring a method findParent via a global mixin, which looks for the offending parent component, and then accessing the computed property like so:
Prior to 2.5.0 this worked nicely; however, when updating to 2.5.2 this code broke.
I do have a workaround: turning the computed property in question into a data property, and using a watch to sync its value with the individual selection flags. But that's hardly ideal.
Version
2.5.2
Reproduction link
http://jsfiddle.net/pLvn7o95/
Steps to reproduce
What is expected?
The computed property setter is called.
What is actually happening?
The computed property setter is not called and the following message appears in the JavaScript console:
[Vue warn]: Avoid adding reactive properties to a Vue instance or its root $data at runtime - declare it upfront in the data option.
This appears to be a regression in Vue 2.5.0, as changing the Vue version in the provided jsFiddle to 2.4.0 fixes the bug. The optimisation applied earlier in the 2.x-series to declare computed properties on the component's prototype appears to interfere with the call to hasOwn in function set (in observer/index).
The text was updated successfully, but these errors were encountered: