Can I have server only context that i can access in my router ?
I'm experimenting with Tanstack start and tRPC. I want to be able to prefetch some queries in my loader and by dehadryte and hydrate the queryClient get the data on the client.
I'm using createServerSideHelpers to create the context I want to use in the router but it can't be packed in the client bundle. I've try to create separate routers one for the client and one for the server but it doesn't seems to work like I expect: type are not ok and the code is packed in the server bundle.
Do you have any exemple of having server only context ?
do you have any input about how I can achieve prefetch with tanstack start ?
is there any trick with vite to have on router definition but different code depending on if we are on the server or the client ?
I'm using createServerSideHelpers to create the context I want to use in the router but it can't be packed in the client bundle. I've try to create separate routers one for the client and one for the server but it doesn't seems to work like I expect: type are not ok and the code is packed in the server bundle.
Do you have any exemple of having server only context ?
do you have any input about how I can achieve prefetch with tanstack start ?
is there any trick with vite to have on router definition but different code depending on if we are on the server or the client ?
The server-side helpers provides you with a set of helper functions that you can use to prefetch queries on the server. This is useful for SSG, but also for SSR if you opt not to use ssr: true.