Skip to content

Issue with createGlobalState #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Demivan opened this issue Sep 22, 2020 · 5 comments
Closed

Issue with createGlobalState #130

Demivan opened this issue Sep 22, 2020 · 5 comments

Comments

@Demivan
Copy link
Contributor

Demivan commented Sep 22, 2020

createGlobalState stops tracking changes after component that first used global state is disposed.

Tried it with vue@3 and can reproduce it there too, so it is not @vue/composition-api issue.

Added pull request with reproduction tests: #129

@antfu
Copy link
Member

antfu commented Sep 22, 2020

This is a limitation of Vue's current API design: vuejs/core#1532

I am already working on an RFC to addressing this: vuejs/rfcs#212

Thanks

@Demivan
Copy link
Contributor Author

Demivan commented Sep 22, 2020

Thanks for info. Will monitor RFC then.
Maybe this caveat should be added to vueuse docs for now?

@Demivan
Copy link
Contributor Author

Demivan commented Sep 23, 2020

Inspired by effectScope I have fixed #129 by creating new Vue component to hold reactive scope. Seems to work fine with Vue 2 and 3

@antfu
Copy link
Member

antfu commented Sep 23, 2020

I think that will do for now, thanks!

@antfu
Copy link
Member

antfu commented Sep 23, 2020

Released in 4.0.0-beta.16.

@antfu antfu closed this as completed Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants