vue icon indicating copy to clipboard operation
vue copied to clipboard

Computed properties on an instance can get tied to the active scope VM rather than the instance itself

Open chearon opened this issue 1 year ago • 0 comments

Version

2.7.8

Reproduction link

jsfiddle.net/p0Leh19d/

Steps to reproduce

  1. In the fiddle, hit the "increase X" button to see the watcher working.
  2. Click "Use new instance of component"
  3. Hit "increase X"
  4. The computed doesn't update

If you change the URL to Vue 2.6, the example does work.

In Vue 2.7.x, computed properties can get destroyed and stop working if their instance is created inside of another component's created, but the instance is also used again by another component later.

What is expected?

Computed properties should only be torn down by their own instance

What is actually happening?

Computed properties are getting torn down by another instance destroying


To me it looks like the conditional on this line should be reversed: shouldn't it be vm._scope || activeEffectScope?

chearon avatar Jul 27 '22 15:07 chearon