vue
vue copied to clipboard
Computed properties on an instance can get tied to the active scope VM rather than the instance itself
Version
2.7.8
Reproduction link
Steps to reproduce
- In the fiddle, hit the "increase X" button to see the watcher working.
- Click "Use new instance of component"
- Hit "increase X"
- 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
?