Open yoshrubin opened 8 months ago
@posva Hey thanks for adding labels, from what I can tell this appears to be an issue with nuxt-bridge
as well which will be an issue for anyone trying to make the move from Nuxt2 to Nuxt3.
Happy to provide a repro for that as well if it will help narrow down the source of this issue.
it appears that the issue is here packages/pinia/src/store.ts#L179C19-L179C19 the computed is getting re-evaluated multiple times even though the dependencies aren't changing.
I did come across this discussion that I am unsure if it is relevant or not https://github.com/vuejs/pinia/discussions/1020 and he references
ssr: make computed inactive during ssr, fix memory leak (f4f0966), closes #5208
from the vue 3.2.27 CHANGELOG
@posva seems like the "issue" I mention here is actually the intended functionality based on responses to https://github.com/vuejs/vue/issues/10151 and https://github.com/nuxt/nuxt/issues/2447. Wish there was a better solution or more documentation for this kind of issue (maybe a mention in the SSR section of the Docs). Happy to contribute to the docs myself when I clear some time for it.
Reproduction
https://github.com/yoshrubin/pinia-ssr-bug
Steps to reproduce the bug
yarn build && yarn start
Expected behavior
To return a cached version of the getter
Actual behavior
the
getter
was called for each loop in thev-for
loop instead of returning a cached versionAdditional information
The issue is for Nuxt2 with
@pinia/nuxt@0.2.1
which usespinia@^2.1.7