tRPC

T

tRPC

Join the community to ask questions about tRPC and get answers from other members.

Join Server
Jjunior112/2/2023

setting up trpc in next 14

Pleaase I need help on how to integrate trpc in next js 14, please help me
Yyaba10112/2/2023

migration trpc from pages to app router in Next.js

How can I migrate trpc from page route to app router
Yyaba10112/1/2023

Have anyone tried migration from TRPC router to app router api

I was learning the trpc and I wanna know to go back and forth with trpc and restapi. can anyone know how to migrate from trpc to app router api route
Ppkfire11/30/2023

Has anyone integrated trpc + udp (quic/webtransport api)?

Hi all, I'm thinking about taking advantage of quic for a certain part of my project. Basically I'm trying to capture user movement in 3d space, and I think udp might be a bit better to work with. Has anyone seen a trpc-link out there trying to do this? Has anyone experimented with this?
AGAlex Gomes11/30/2023

onSuccess invalidate

I'm trying to follow along with Theo's T3 tutorial using the latest Next version and the app router. The "setInput("")" and the invalidation don't seem to be working inside of onSuccess, the console.log is being called, what am I missing? Is this supposed to work? ```ts "use client"; ...
LLuka11/29/2023

React Query client and caller client under one object

Would love to know if it is possible to have caller and react query clients under one object? I feel like it would be great to go api.cart.getCartItems() in server components that would utilise caller and api.card.getCartItems.useQuery() in client components....
Ssommeeer11/28/2023

I want to refetch and set the inital data of an useState

Hello guys, currently i am retrieving the data i use in useState with SSR, but i want to use somethinng that makes it possible to update the useState on interactions from the user. Im guessing I should use useQuery?
How can i set it so initialData in my useState works. this is my current useState line: ```tsx...
Jjustindgm11/28/2023

Vanilla Client Error Handling

What is the right way to handle errors when using the vanilla client? If I setup a client like so: ``` import type { Router } from '../../../server/src/routers'...
Solution:
There is actually a docs page on this, does that answer the question? https://trpc.io/docs/client/vanilla/infer-types#infer-trpcclienterror-types
AAtanga192011/27/2023

sidebar search

Please how will I implement a search on the left sidebar to let the items on the search bar be searchable
No description
Aacronie11/26/2023

WS with TRPC

```ts │  Type '({ req, res, }: { req: Request; res: Response; }) => CreateInnerContextOpts' is not assignable to type 'NodeHTTPCreateContextFn<CreateRouterInner<RootConfig<{ ctx: CreateInnerContextOpts; meta: object; errorShape: { data: { zodError: typeToFlattenedError<any, string> | null; code: "PARSE_ERROR" | ... 13 more ... | "CLIENT_CLOSED_REQUEST"; httpStatus: number; path?: string | undefined; stack?: string | undefined; }; me...'. typescript (2322) [12, 3] │ Types of parameters '__0' and 'opts' are incompatible. │ Type 'NodeHTTPCreateContextFnOptions<IncomingMessage, WebSocket>' is not assignable to type '{ req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>; res: Response<any, Record<string, any>>; }'. │ Types of property 'req' are incompatible. ...
BBert11/25/2023

tRPC is butchering object types in return types

So if I have a mutation that returns this type
{ name?: string }
{ name?: string }
the type that tRPC infers for the mutation is...
DDxD11/24/2023

Why my Authorization does not update ?

i have this in _app.tsx ```export default function App({ Component, pageProps }: AppProps) { return ( <> <Head> <title lang="en">Holistic Drop</title>...
Ttmy0311/23/2023

TypeError: queryClient.getMutationDefaults is not a function (it is undefined)

Hi! There's not much code to show here, as I'm really not sure where the error actually occurs. In my React component I have:...
JJonathan11/22/2023

useQuery never returning or hitting API

I have something off in my configuration, i copied most of the files from the ❯ npm create t3-app@latest example app to add to an exisitng app. I am trying to call the simple post.hello and i tis working on the server. but when I call it on the client side like:
const postResult = api.post.hello.useQuery({text:'Hello'});
const postResult = api.post.hello.useQuery({text:'Hello'});
...
JJonathan11/22/2023

Type 'QueryClient' is missing the following properties from type 'QueryClient': queryCache, mutation

I am trying to setup a new project and doing my first client side query and getting this error:
Type 'QueryClient' is missing the following properties from type 'QueryClient': queryCache, mutationCache, logger, defaultOptions, and 4 more.
Type 'QueryClient' is missing the following properties from type 'QueryClient': queryCache, mutationCache, logger, defaultOptions, and 4 more.
...
Solution:
This was due to a mismatch in the react-query version on my project.
Jjuico11/22/2023

trpc mutation call stuck

I have an issue with a simple mutation procedure: `getPublicUser: publicProcedure .input(z.object({ walletAddress: z.string()...
PPieter11/22/2023

Create client based on OpenAPI

Hi! I am running a golang server with an openapi spec and would love to use trpc client in my frontend with my golang api. Is it possible to create a trpc client based on open API?
DDevThoughts11/22/2023

TRPC with react query, getting error twice?

When i am try to show TRPC error in the client side with react-query, i am getting error twice from ...batch=1&....., any idea?
S1Sonny11/22/2023

Error building create-t3-app: Page couldn't be rendered statically because it used `cookies`

I get the following error when building create-t3-app:
TRPCClientError: Dynamic server usage: Page couldn't be rendered statically because it used `cookies`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error
TRPCClientError: Dynamic server usage: Page couldn't be rendered statically because it used `cookies`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error
...
Next