sh03
sh032mo ago

Simplifying SSR (e.g. in Next.JS)

I'm just trying to figure out if I'm missing something or if somebody else already tries this but: Wouldn't it be theoretically possible, for SSR, to detect when a useQuery is being SSR (e.g. checking typeof window === 'undefined') and therefore await the fetch call automatically and then pass it to initialData to rehydrate on the client?
3 Replies
sh03
sh03OP2mo ago
Just to be clear I'm not complaining that this hasn't happened yet. I'm just trying to understand why this isn't the best solution.
Michael Schaufelberger
Hi @sh03 Have you found a solution to this?
sh03
sh03OP2w ago
I'm using Tanstack Start with useSuspenseQuery and ensureQueryData

Did you find this page helpful?