Next.js Discord

Discord Forum

How to stream client components to the browser after data is fetched in server on Initial Render?

Unanswered
aprilia posted this in #help-forum
Open in Discord
We are heavily invested on TanStack query. The problem is we are now required to fetch all the data on the server side only and not on client side. So TITLE.
It would be amazing if I can use the experimental ppr with this

3 Replies

I think i was able to get it work somehow but got the error: Server Functions cannot be called during initial render. This would create a fetch waterfall. Try to use a Server Component to pass data to Client Components instead. which is valid
I can easily avoid this by using something like an isMounted hook, but not sure if thats the right way :(
Ok, I removed all the Suspense shenanigans and it seems to work just fine 🤔