Open ts0307 opened 6 years ago
FYI: Ignoring getters was done on purpose due to #7280. I added an exception for getter/setter pairs in #7828 to fix my own use case. I don't know whether ignoring pure getters is right or not, but either way it's clear that somebody will be unhappy.
It seems that it is difficult to be compatible with all use cases.
@ts0307 if a getter is defined, proving that the property is an accessor property. If an accessor property does not have a setter, that means the property cannot be set new Value, thus there is no need to make it be recursive reactive.
why not? let childOb = !shallow && observe(val) --> get: function reactiveGetter () { const value = getter ? getter.call(obj) : val; childOb = !shallow && observe(value);
Version
2.5.17-beta.0
Reproduction link
https://jsfiddle.net/ts0307/pd8zr3sk/
Steps to reproduce
Run JSFiddle snippet
What is expected?
I expect, the result is shown as {"bar": "b"} instead of {"bar": "a"}
What is actually happening?
if ((!getter || setter) && arguments.length === 2) { val = obj[key] }
let childOb = !shallow && observe(val)
My example is that the data object defines that the getter does not define a setter, causing the above judgment to fail, val is not evaluated, and no recursive reactive is made.