You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the reproduction, if you do any one of the following, the problem disappears, and the store is properly hydrated:
Visit /en instead of /en/comment/1.
Uninstall i18n from the project.
Remove the routeRules for /*/comment/**
I tried to debug this by stepping through the generated code in .output/server/. Much of the code there I don't fully understand (being a user of Nuxt3 rather than a core developer), but here is what I could gather:
In .output/server/node_modules/pinia-plugin-persistedstate/dist/index.mjs we have:
Describe the bug
In some very specific circumstances, stores are not hydrated from the cookies.
This is a very esoteric issue. It took me many many hours to finally get a minimal reproduction, and even then I don't understand completely what is happening. See the stackblitz link below for the code. Here is a screen capture video where I walk through the problem: https://github.com/prazdevs/pinia-plugin-persistedstate/assets/10025342/c6651243-f3fc-40a9-aafd-1762d6a8453c
In the reproduction, if you do any one of the following, the problem disappears, and the store is properly hydrated:
/en
instead of/en/comment/1
.i18n
from the project.routeRules
for/*/comment/**
I tried to debug this by stepping through the generated code in
.output/server/
. Much of the code there I don't fully understand (being a user of Nuxt3 rather than a core developer), but here is what I could gather:In
.output/server/node_modules/pinia-plugin-persistedstate/dist/index.mjs
we have:storage.getItem()
is a call to thegetItem
method inusePersistedstateCookies()
which is seen in.output/server/chunks/build/server.mjs
:Stepping into
useCookie()
, we find:Stepping into
readRawCookies()
, we find:At this point, I put in some
console.log
statements to see what is going on:If we do this, then we see the following:
req.headers
and inreq.rawHeaders
.req.rawHeaders
, whilereq.headers
is completely empty. This is where I gave up.Reproduction
https://stackblitz.com/edit/github-5b43sb-okx9lc
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: