Skip to content
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

"getActivePinia() was called but there was no active Pinia" on Pinia 0.6+ #1946

Open
daniandl opened this issue Oct 31, 2024 · 1 comment
Open

Comments

@daniandl
Copy link

daniandl commented Oct 31, 2024

Environment

playground

Reproduction

https://stackblitz.com/edit/nuxt-starter-sbdhjb?file=app.vue

Describe the bug

This only seems to happen when using the decorator syntax?
I know the package says it only supports Pinia 0.5.1 but I figured I'd track this anyway.
It's also a bigger issue because Pinia <0.6 does not work with latest Nuxt due to this fun error nuxt/nuxt#27544

The current workaround is to pass useNuxtApp().$pinia when calling useRepo(), but this feels very hacky.
However, I plan to stay on 0.5.1 and install the @vue-devtools/api so the app can mount, as I'm scared there may be other hidden issues when upgrading.

Are there plans to support Pinia 0.6+ with the new 1.10.0 version in the pull requests?

Additional context

No response

Logs

No response

@daniandl
Copy link
Author

daniandl commented Oct 31, 2024

When I went to build my application I sadly saw that this setup gets the same error as #1925 :(
https://stackblitz.com/edit/nuxt-starter-ddhtbs?file=app.vue

Here you can try changing the package version from 0.6.1 to 0.5.1 or any other combination that you want.
After building --> pnpm run preview and upon loading the page we get the _s undefined (iirc means pinia is undefined).

If you then go into the app.vue and toggle the useNuxtApp().$pinia pass to useRepo, it works.
Is this the only way to get the decorator syntax working with Nuxt 3.12+?

This has been a very exhausting journey for our team, it is a huge roadblock... would really appreciate some help on this :)
As it stands I have no idea how this package is meant to be used from just following the guide in the docs :(

EDIT: updated repro with pinia nuxt 0.7 and nuxt 3.14, same issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant