vuejs / pinia

🍍 Intuitive, type safe, light and flexible Store for Vue using the composition api with DevTools support
https://pinia.vuejs.org
MIT License
13.17k stars 1.06k forks source link

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

Closed tkallage closed 1 year ago

tkallage commented 1 year ago

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: https://github.com/vueuse/vue-demi/issues/224

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

softy2k commented 1 year ago

Same issue. Reverting to 2.0.36

LiuJiaWeb commented 1 year ago

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

posva commented 1 year ago

I overlooked iife when adding the feature to vue-demi. I opened a PR to fix it https://github.com/vueuse/vue-demi/pull/225

posva commented 1 year ago

A fix was released in vue-demi 💯

K4T commented 1 year ago

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 commented 1 year ago

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:

https://github.com/vueuse/vue-demi/issues/228

posva commented 1 year ago

After https://github.com/vueuse/vue-demi/pull/229, all possible versions should be properly covered 😅