-
Notifications
You must be signed in to change notification settings - Fork 344
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
Subtle problems with global state #535
Comments
Can you provide a repo or code sandbox? |
Also are you using the latest version? https://github.com/vuejs/composition-api/releases/tag/v1.0.0-beta.14 |
You can solve this problem like this
composition-api.js
|
@alekseymvt Thanks, this solves it and at the same time adds no complexity to the code that would be redundant with Vue3. |
I have added the snippet from @alekseymvt to the readme. I think that this is a difference to the behaviour in Vue3 and maybe it saves others from headache, too. See PR above. |
Just came here to say I've had this issue caused by upgrading to [email protected] |
When components are imported synchronously, a file using
reactive
orref
on the module level (outside of functions) may be read before the application is created. This leads to an error on the console:Error: [vue-composition-api] No vue dependency found.
To work around the problem, the consuming component can be made an asynchronous one (with the
Component: () => import('./Component')
syntax.Otherwise, only
ref
orreactive
declared within a function body (which is called after the app has been loaded) seems to work.In Vue3, I could not reproduce the same.
The text was updated successfully, but these errors were encountered: