T
TanStack4mo ago
rare-sapphire

TRPC with ensureQueryData/Prefetch

Hey Folks, I'm having some issues with using trpc and fetching on the server before sending it down with trpc / tanstack query am I doing something wrong here?
No description
3 Replies
rare-sapphire
rare-sapphireOP4mo ago
I feel like tanstack isn't sending any headers from the loaders requests?
foreign-sapphire
foreign-sapphire4mo ago
I literally just fought with this exact same problem a while back if it is with cookies. Mind sharing a snippet of yours createTRPCClient? I solve my problem using createIsomorphicFn and getHeaders
No description
rare-sapphire
rare-sapphireOP4mo ago
That was it! Perfect Needed to use the createIsomorphicFn
export const headers = createIsomorphicFn()
.client(() => {})
.server(() => getHeaders());
export const headers = createIsomorphicFn()
.client(() => {})
.server(() => getHeaders());
Legend! Thanks

Did you find this page helpful?