Skip to content

computed value becomes undefined inside onUnmounted hook unless it's accessed before #3099

Closed
@kiaking

Description

@kiaking

Version

3.0.5

Reproduction link

https://codesandbox.io/s/priceless-lalande-eh4wx?file=/src/views/Home.vue

Steps to reproduce

  1. Go to Codesandbox.
  2. Open console window in Codesandbox.
  3. First access "Home" page, then move to "About" page.
  4. You'll see computed value becoming undefined.
  5. If you un-comment console.log(computedObj.value) right above the onUnmounted hook. The value becomes visible inside onMountedhook.

What is expected?

Not sure. Is this expected?

What is actually happening?

Not sure. I think it would be OK for computed or any other reactive value to be undefined inside onUnmounted, but I think it would be better to have consistent behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.🐞 bugSomething isn't workingscope: reactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions