I can’t see the store (pinia) in the DevTools when there’s a middleware
This index.vue
middeware/auth.ts
If has auth middleware when open devtools -> pinia not found store, but comment middleware: ["auth"] I can founded modal store


4 Replies
Hi @jetnipat_.. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
This behavior matches a couple of Nuxt/Pinia “gotchas” shown in the sources:
1. Stores only appear in DevTools after they’re actually used in a component lifecycle.
In the Pinia question, the store didn’t show up at all until it was imported and
You already call
Route middleware runs during navigation via Vue Router before the page is rendered. [Route middleware runs]
If middleware causes redirects or errors (even subtle ones), the page component may never mount, so
In the Pinia question, the store didn’t show up at all until it was imported and
useUserStore() was called inside a component. [Pinia store init]You already call
useModalStore() in index.vue, so that part is correct.
2. Middleware and navigation can change when the store is created / visible.Route middleware runs during navigation via Vue Router before the page is rendered. [Route middleware runs]
If middleware causes redirects or errors (even subtle ones), the page component may never mount, so
useModalStore() is never executed and the store doesn’t appear in DevTools.
From the provided sources there is no specific bug documented that “having any middleware hides Pinia stores from DevTools”. The most likely explanations, based on what is documented:
- The auth middleware is preventing the page from fully loading/rendering on the client, so useModalStore() is never called.
- Or there’s a navigation loop / redirect pattern similar to the infinite-redirect issues shown in other middleware questions, where route guards keep re‑running and the page never settles enough for stores to be instantiated. [Middleware redirect loop]
What you can verify:
1. Ensure the middleware does not redirect or abort in this test:
Then reload and open DevTools → Pinia.
2. Confirm that useModalStore() is really executed on the client (add a console.log('modal store used') right after calling it in index.vue).
If with a no-op middleware the page renders (you see the console log from index.vue), but the store still never appears in DevTools, that specific interaction (DevTools + Pinia + route middleware) is not described in the provided sources, so I can’t point to an official Nuxt bug or configuration fix from these documents.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@917899762546651175> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
I just noticed that when I first open the page, the stores show up. But after refreshing the page the second or third time, the stores disappear.
Sometimes when I refresh the page, the store shows up, but most of the time it doesn’t.
I just tried enabling ‘Disable cache’, and now the store shows up every time I open the page.
