Nuxt 3 persistent cache
I'm trying to convert the Nuxt SSR plugin example into a localstorage persister. But i'm getting stuck on the different QueryClients between the @tanstack/vue-query package and the @tanstack/query-core package.
Did anyone manage to get this to work in Nuxt 3?
This is my plugin at the moment but it fails on the QueryClient
2 Replies
compatible-crimson•3y ago
Is it only a type error? Cause you can import
QueryClient
from @tanstack/vue-query
, not @tanstack/query-core
If it's another error, could you provide a codesandbox with a reproduction and description what exactly does not work for you?sensitive-blueOP•3y ago
I think i found my issue. The packages were not using the same @query-core versions.
after upgrading them all to:
I was able to build and run my app again. Now i have some hydration warnings and no cache in localstorage yet. So any advice would still be much appreciated.
SSR does not work with localstorage. That is only available client side. Makes sense.
So is there a way to persist a json page config even after reloading the browser when using SSR?