Skip to content

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

Closed
@chearon

Description

@chearon

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions