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

fix: avoid nuxtContext in spa mode #170

Merged
merged 1 commit into from
May 25, 2020
Merged

Conversation

MartinMalinda
Copy link

Fixes #161

Not calling the setStateProvider() in case of missing nuxtContext seems like a safer approach, otherwise it errored out on undefined state provider in some next step.

@posva
Copy link
Member

posva commented May 25, 2020

did you gave this a try in both universal and spa modes in nuxtconfig?

@MartinMalinda
Copy link
Author

MartinMalinda commented May 25, 2020

Without this fix: Cannot read property 'pinia' of undefined (in SPA mode)

With this fix:

[vue-composition-api] must call Vue.use(plugin) before using any function.

both (SPA and universal)

I guess this is becuase I tested via npm link. I'm not sure if I can test via pointing to github because dist is gitignored.

@posva
Copy link
Member

posva commented May 25, 2020

to test locally with linking, you need to link both pinia and @vue/composition-api in your app as well as @vue/composition-api in pinia to make sure both pinia and your App use the same library. It's a bit... convoluted

@MartinMalinda
Copy link
Author

@posva

OK, so I just retested with a manual change in node_modules and it seems to be working fine both in SPA and Universal

@posva posva changed the title Don't add state provider if nuxtState is missing fix: avoid nuxtContext in spa mode May 25, 2020
@posva posva merged commit a0d10f9 into vuejs:master May 25, 2020
@posva
Copy link
Member

posva commented May 25, 2020

Thanks!

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

Successfully merging this pull request may close these issues.

Nuxt crashes in SPA mode
2 participants