Skip to content

Pinia 2.1.0 + Vue 2.7.14: Error "VueCompositionAPI is not defined" in hasInjectionContext() #2208

New issue

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

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

Already on GitHub? # to your account

Closed
tkallage opened this issue May 17, 2023 · 7 comments

Comments

@tkallage
Copy link

Reproduction

https://jsfiddle.net/egay83mp/4/

Steps to reproduce the bug

Use Pinia 2.1 with Vue 2.7.14

Expected behavior

no exception is thrown

Actual behavior

An exception is thrown when using a defined store:
grafik
grafik
grafik

Additional information

Opened issue in vue-demi:
vueuse/vue-demi#224

JSFiddle with Pinia 2.0 (working):
https://jsfiddle.net/mk56hoqe/2/
JSFiddle with Pinia 2.1 (broken):
https://jsfiddle.net/egay83mp/4/

@tkallage tkallage changed the title Vue 2.7: Error "VueCompositionAPI is not defined" in hasInjectionContext() Pinia 2.1.0 + Vue 2.7.14: Error "VueCompositionAPI is not defined" in hasInjectionContext() May 17, 2023
@softy2k
Copy link

softy2k commented May 17, 2023

Same issue.
Reverting to 2.0.36

This was referenced May 17, 2023
@LiuJiaWeb
Copy link

Update Pinia to v2.1.0,Vue version is v2.7.14
I also ran into this bug

Copy link
Member

posva commented May 17, 2023

I overlooked iife when adding the feature to vue-demi. I opened a PR to fix it vueuse/vue-demi#225

@posva posva closed this as completed May 17, 2023
Copy link
Member

posva commented May 17, 2023

A fix was released in vue-demi 💯

@K4T
Copy link

K4T commented May 17, 2023

Unfortunately after spending hours on it I also had to rollback to 2.0.36 to fix the same problem in my project.

For Pinia 2.1.1 with Vue 2.7.14 bug still appear.

@tkallage
Copy link
Author

I can confirm, that the error still exists in pinia 2.1.1 / vue-demi 0.14.3.

I opened a new issue in the vue-demi repository with updated example code:

vueuse/vue-demi#228

@posva
Copy link
Member

posva commented May 17, 2023

After vueuse/vue-demi#229, all possible versions should be properly covered 😅

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants