Skip to content
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

Wrong context for computed getters in 0.11.0 #447

Closed
divmain opened this issue Sep 28, 2014 · 1 comment
Closed

Wrong context for computed getters in 0.11.0 #447

divmain opened this issue Sep 28, 2014 · 1 comment

Comments

@divmain
Copy link

divmain commented Sep 28, 2014

I'm not sure what your preference is in regards to submitting issues against 0.11.0 release candidate - I hope you don't mind my filing a bug.

As illustrated here, in the context of a v-repeated VM, if a computed property is defined using computedProp: { get: fn () {}, set: fn {} } rather than computedProp: fn () {}, the context for the get method can be incorrect.

My specific case is as follows: given an array (arr) of two elements , render these elements using v-repeat="el: arr" combined with v-component="el-component" v-with="el". When el-component has a computed getter (using get/set object format), the context for this getter is incorrect for the second element in the array (this is the VM of element 1).

In looking through the stack trace, I noticed a double binding for the get method. I'm starting to look through Vue's code to familiarize myself - in the future, I hope to offer a fix in addition to a bug report :)

Thanks again for a great library!

@divmain divmain changed the title Wrong context for computed getters Wrong context for computed getters in 0.11.0 Sep 28, 2014
@yyx990803
Copy link
Member

Thanks for catching this bug! The computed property setup procedure is mutating the original option object, causing it to pollute other instances. This has been fixed in fbd874f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants