Description
Version
2.5.11
Reproduction link
https://jsfiddle.net/7gmh5wL8/1/
Steps to reproduce
- Run JSFiddle snippet
- Open browser console
- You'll see a warning from property getter
What is expected?
I expect, that my data and props enumerable properties will not be invoked, without my explicit call for them.
What is actually happening?
Seems, that defineReactive
function in /src/core/observer/index.js
works that way, that it accepts an object property value, instead of getting it from the getter on demand. Despite the fact, that it uses getOwnPropertyDescriptor
to respect user-defined getters and setters.
I faced this problem in a context of lazy-loaded backend entities. I have some redux store selectors, that returns RESTfull models. Some of the models nested properties are wrapped into getters, so I can call them, if needed and trigger a background api request for additional info. Now, all of the getters are invoked immediately and a bunch of requests is sent after initial rendering.
I can do a pull request, to fix this, but may be I do not understand some concept under this behaviour.
Sorry for bad english.