Data property read in prop watch treated as a rendering dependency
Version
3.0.4
Reproduction link
https://jsfiddle.net/skirtle/yuq96a0c/
Steps to reproduce
- Click 'Button 1'.
- Click 'Button 2'.
- Note the logging.
What is expected?
Clicking 'Button 2' should not cause anything to be logged.
What is actually happening?
Clicking 'Button 2' is logging a message, indicating that the component has re-rendered.
Clicking the first button causes a prop to change, triggering the watcher. The watcher accesses a property, which is then incorrectly tracked as a rendering dependency.
I reported this previously as part of #2521 but it was only partially fixed.
a little complicated
https://github.com/vuejs/vue-next/blob/8936e53b10a507b80ffc5b0ecaa6a1a0322f46cc/packages/runtime-core/src/componentOptions.ts#L903-L937
Maybe, need to use pauseTracking
, resetTracking
wraps handler
.