Skip to content

WatchEffect's onCleanup is not firing when component is unmounted #293

@geekox86

Description

@geekox86

Greetings,

I am using watchEffect in a component that is loaded by router-view.
After the route is changed, this component is unmounted.
I was expecting onCleanup to fire at this time.
Is this a correct expectation?

To my humble information, vue-router does not cache routing components, so I am assuming they are being destroyed. If that is not the case, then how can I ensure proper cleanup while leveraging the router's cache?

Btw., the Vue Composition API official documentation is calling onCleanup as onInvalidate which was a bit confusing to me. May be I was on the wrong docs version.

Thank you.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghas PR

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions