returning undefined from server gets stripped on the client
I encounter this issue when working with TRPC React under a Turborepo. But I works fine on Next
I see that its been merged but still appearing on my end
https://github.com/trpc/trpc/issues/4049
GitHub
bug: returning
undefined
from server gets stripped on the client ...Area of Improvement Please add an explanation to Quickstart of why user has type User | undefined on the server: .query((req) => { const input = req.input; const user = userList.find((it) => ...
3 Replies
That ticket is unrelated to what you're showing
React Query adds undefined to the type, because until the query has completed, it's undefined
But this is a react query thing, not to do with tRPC
thanks for replying @Nick Lucas . The point is I need that
undefined
. How do i fix it on the React app ?Oh sorry, missed it in the first image
Could you open a GitHub issue? Looks potentially related to react vs next
(But the issue template will collect other possibly related information)