TRPC NUXT req run 2 times(on server and client)
Hi everyone, I have a problem using DataCache in SSR.
I am using this function to "GET" my plan.
But every time I navigate to this page, I see an http request. It's like the data is not being cached...
![No description](https://cdn.answeroverflow.com/1246038892310691890/image.png)
11 Replies
It does another request when the data is stale, read tanstack query important defaults. If you don’t believe it’s SSRing you can validate that with the HTML in the response in your dev-tools.
yeah i think it's that, but i can't really fix this.
i have used this lib: "trpc-nuxt": "^0.10.21"
![No description](https://cdn.answeroverflow.com/1246087938996047912/image.png)
this function use 'query' to get data, and in my page i use 'usequery'
![No description](https://cdn.answeroverflow.com/1246089196633063444/image.png)
i have 1 ssr in my terminal correctly, but i still have un in chrome
You can change the default behaviour when you init the query client or on the query itself
useQuery(undefined, options)
and disable the refetch optionsThanks bro, but I think I still have the feature...if you have time, can we have a quick meeting?
Try setting the getCachedData properties in the useQuery options
https://nuxt.com/docs/api/composables/use-async-data#params
![No description](https://cdn.answeroverflow.com/1246724780242239519/image.png)
![No description](https://cdn.answeroverflow.com/1246724780623659048/image.png)
i think it's @nuxt/devalue that can not stringify the function response