#has anyone succesfully integrated TRPC with tanstack start WITH SSR?
4 messages · Page 1 of 1 (latest)
This might help https://youtu.be/dLUyPLbvdY0?si=9_Iz17ZNx-Pwu3w5
tRPC version 11 now integrates tightly with TanStack Query. Let's try it out on TanStack Start and find out how to query both inside and outside the React context.
Code: https://github.com/jherr/start-trpc/tree/main/start-trpc-pt-1
Part 1: What you're watching now
Part 2: https://youtu.be/uE4devDh2rU
This video was sponsored by Infinite Red: ...
but this does not have auth part with ssr?
export const trpc = createTRPCOptionsProxy<AppRouter>({
client: createTRPCClient({
links: [
httpBatchStreamLink({
url: `${import.meta.env.VITE_BETTER_AUTH_URL}/api/trpc`,
fetch: (url, options) => {
if (typeof window === "undefined") {
const headers = getHeaders();
return fetch(url, {
...options,
headers: {
...options?.headers,
...headers,
},
});
}
return fetch(url, options);
},
}),
],
}),
queryClient: TanstackQuery.getContext().queryClient,
});