Skip to content

@pinia/nuxt - No Active Pinia - Advanced Implementation from another pluginΒ #3084

@silverbackdan

Description

@silverbackdan

Reproduction

https://github.com/components-web-app/cwa-nuxt-module/tree/dev

Steps to reproduce the bug

When running my application I have a module, it adds plugin and it creates many stores that are needed.

https://github.com/components-web-app/cwa-nuxt-module/blob/dev/src/runtime/plugin.ts

It was all working fine until recent updates either within Nuxt or this module.

The CWA class creates a sub-class of storage where all the store definitions are created. Before they are created I've confirmed and there is an active pinia instance.

When I am trying to access the stores now, I get "getActivePinia()" was called but there was no active Pinia.

Before I access the stores I use my own composable useCwa - I've also checked in there and the pinia instance appears to be there as the object in useNuxtApp app response.

I think this line causes all my issues...

https://github.com/vuejs/pinia/blob/v3/packages/nuxt/src/runtime/plugin.vue3.ts#L29

Expected behavior

I should be able to access my stored after the app is rendered, or the hook is called at the wrong time or... something horrendous is happening as a side-effect for me here. Thoughts?

Actual behavior

500 errors.

Additional information

This is a discussion point to address with questions, I'm happy to work on things my side, I just want to understand the context for this change, and see if this is a Pinia bug from my edge use case, or something which I need to work out a new implementation of.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    βœ… Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions