vue-query-nuxt
vue-query-nuxt copied to clipboard
Question: Support SSR
Describe the feature
Does this support SSR?
In the SSR & Nuxt Docs. It uses onServerPrefetch to support SSR.
Is this needed with this plugin? Or even supported?
Additional information
- [ ] Would you be willing to help implement this feature?
Hello @Hebilicious, would you confirm that plz, thanks in advance
https://github.com/Hebilicious/vue-query-nuxt/blob/c6f88bc1a61e04870e0ebd93ba600f2bb85e0932/packages/vue-query-nuxt/src/runtime/plugin.ts#L17-L23 is similar with https://github.com/TanStack/query/blob/51d3e8f0cb568bb382a17490ece2b852616c6830/docs/framework/vue/guides/ssr.md?plain=1#L39-L46
So you do need:
const { suspense } = useQuery(...);
onServerPrefetch(suspense);
Or using useFetch()/useAsyncData() from nuxt which handle SSR automatically in combine with vue-query(replacing $fetch() in query function), but it will cause hydrate mismatch: https://github.com/Hebilicious/vue-query-nuxt/issues/46
Thanks for answring @n0099, I think this might be worth adding to the README.