vuejs / composition-api

Composition API plugin for Vue 2
https://composition-api.vuejs.org/
MIT License
4.19k stars 343 forks source link

Internal watcher retained after hook:destroyed? #938

Closed nerdcave closed 2 years ago

nerdcave commented 2 years ago

Should this watcher be set to null upon hook:destroyed?

I'm working on an app where a destroy() call causes "shared" computeds to stop updating. I believe Vue is removing its subscriptions under the hood while this watcher in the composition-api plugin is retained.

Code in following comment...

nerdcave commented 2 years ago

I was able to create a minimal example that reproduces the bug: https://github.com/nerdcave/composition-bug

Clone the repo, run yarn install then yarn test:unit. The last expect in the test fails.

nerdcave commented 2 years ago

Not a bug, it's a scope issue. Just discovered new EffectScope(true), which fixes it.