Skip to content

Commit f294d47

Browse files
worldzhaoworldzhao
andauthored
docs: correct nuxt2 example (TanStack#6702)
Co-authored-by: worldzhao <[email protected]>
1 parent 72c3a06 commit f294d47

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/vue/guides/ssr.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ export default (context) => {
8787
Vue.use(VueQueryPlugin, options)
8888

8989
if (process.client) {
90-
if (context.nuxtState && context.nuxtState['vue-query']) {
91-
hydrate(queryClient, context.nuxtState['vue-query'])
90+
if (context.nuxtState && context.nuxtState.vueQueryState) {
91+
hydrate(queryClient, context.nuxtState.vueQueryState)
9292
}
9393
}
9494
}
@@ -134,11 +134,11 @@ export default defineComponent({
134134
// This won't be prefetched, it will start fetching on client side
135135
const { data2 } = useQuery("todos2", getTodos);
136136

137+
const { ssrContext } = useContext();
138+
const queryClient = useQueryClient();
139+
137140
onServerPrefetch(async () => {
138-
const { ssrContext } = useContext();
139-
const queryClient = useQueryClient();
140141
await suspense();
141-
142142
ssrContext.nuxt.vueQueryState = dehydrate(queryClient);
143143
});
144144

0 commit comments

Comments
 (0)