tao_zei
tao_zei7mo ago

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
11 Replies
BeBoRE
BeBoRE7mo ago
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.
tao_zei
tao_zeiOP7mo ago
yeah i think it's that, but i can't really fix this. i have used this lib: "trpc-nuxt": "^0.10.21"
tao_zei
tao_zeiOP7mo ago
No description
tao_zei
tao_zeiOP7mo ago
this function use 'query' to get data, and in my page i use 'usequery'
tao_zei
tao_zeiOP7mo ago
No description
tao_zei
tao_zeiOP7mo ago
i have 1 ssr in my terminal correctly, but i still have un in chrome
BeBoRE
BeBoRE7mo ago
You can change the default behaviour when you init the query client or on the query itself useQuery(undefined, options) and disable the refetch options
tao_zei
tao_zeiOP7mo ago
Thanks bro, but I think I still have the feature...if you have time, can we have a quick meeting?
warflash
warflash7mo ago
Try setting the getCachedData properties in the useQuery options https://nuxt.com/docs/api/composables/use-async-data#params
tao_zei
tao_zeiOP7mo ago
No description
No description
tao_zei
tao_zeiOP7mo ago
i think it's @nuxt/devalue that can not stringify the function response