t3 tRPC - CTX is undefined
Hey all. Finally checking t3 for the first time.
Question.
I was trying to add to the latest post query so that the latest post will be from the current user not all users.
<LatestPost> has a call to getLatest
Which is called serverside first. I am confused why, for the first serverside call, ctx in trpc is null.
To be fair this is fixed when
But I do not understand why I have to prefetch
Apologies if this is not the place to ask this or my question does not make sense.
Question.
I was trying to add to the latest post query so that the latest post will be from the current user not all users.
<LatestPost> has a call to getLatest
const [latestPost] = api.post.getLatest.useSuspenseQuery();Which is called serverside first. I am confused why, for the first serverside call, ctx in trpc is null.
To be fair this is fixed when
void api.post.getLatest.prefetch(); is called in page.tsx But I do not understand why I have to prefetch
getLatest for this to work?Apologies if this is not the place to ask this or my question does not make sense.


