BeBoRE8mo ago

Why use unstable_httpBatchStreamLink in React server components?

When using create-t3-app I noticed that they were using unstable_httpBatchStreamLink in their TRPCProxyClient when using RSC. I find this strange, since you already have access to the actual appRouter, doing an HTTP request to your own server adds a lot of overhead. Why use TRPCProxyClient with unstable_httpBatchStreamLink and why not just use createCaller? I understand why it's done when rendering 'use client' components on the server, because you don't want server code bundled into the client code. But I fail to understand why they opted to also use this method when rendering server components.
1 Reply
Nick8mo ago
Best to ask on that project, but they probably aren't wanting to host tRPC within the NextJS backend Whether that's due to a misconception or a better understanding than you have, is best to find out from their github 🙂