tRPC

T

tRPC

Move Fast & Break Nothing. End-to-end typesafe APIs made easy.

Join

Sequential batch mutation

How one would make a mutation as a sequential mutation batch call? Say I have to add 10 apples to the basket. My API allows only to add one at a time so I need to make 10 mutations one after another plus I would need to catch which one succeeded and which failed....

Have middleware require a "base" input

Is there a way to have middleware add a minimum required input, like an org id? So that every procedure with that middleware always at least gets that passed in

Is it possible to dynamically change the url of httpBatchLink in runtime?

I need to do it because I have 2 domians that share the same NextJS project and I need to be able to point tRPC to the right domain depending on the one the user is currently browsing from

getting manually a subdomain

For some reason I can fetch here the route /test, but not /tester/e
Solution:
Forgot that I had this open, instead of / it uses . so if oyu route is hello/get its hello.get for manual requesting

Ability to perform a tRPC request form a terminal, curl-like

Hey, I wanted to ask if there is conventional a way to do that? I wanted to warmup my lambda but can't find a dead-simple way to stick this into a cron. TY!

Usage of useQuery after pageload?

Hi all! I am new to TRPC so my apologies in advance for a very nooby question: In my [id].tsx file I would like to use the 'id' parameter in my query. Since that takes a fraction of a second to load, I get an unhanded runtime error. What is the proper way to first call my query once the 'id' parameter has been identified, or for that matter later on when the user does something on the page?...

Security question about tRCP

If I export the tRCP router as type in order to import that type in my client JS, wouldn't it mean the entire backend code of my tRCP router would leak to the client file?

Real-world Large Application Examples?

Are there any OSS examples (besides cal.com) demonstrating large tRPC code bases? I want to see how people are structuring their routers and handlers to avoid overly large routers. I was thinking of having each router import all the independent procedures....

Scaling tRPC

I’ve been seeing issues regarding tRPC routers and performance issues as routers grow. I’m wondering if there is any documentation on this and how to avoid them if possible?...

what is the best way to update trpc and its dependencies?

Hi all, as the title says, how can i best update trpc and its dependencies? TRPC stands at 10.25.1, but is this @trpc/server or @trpc/client or next, or tanstack?...

Where i can read a journal about tRPC ?

I use tRPC for my Final Task in my Bachelor Degree, but i can't found journal about tRPC. Can anyone help me. Thanks

Default Query Function to resume paused mutations

I'm building a React Native App with an offline mode. I implemented a PersistQueryProvider and a built my own createMMKVStoragePersister. When the app gets back online it fails to resume paused mutations because at that point functions does not exist. Any advice on providing the default query fucntions since they already exist from the trpcClient?...

SuperJSON is wrapping results in type with keys "json" and "meta"

How can I modify the transformer in SuperJSON library to only return the "json" property and ignore the "meta" property during serialization? The current behavior of the library wraps the results in the SuperJSONResult interface, but I want to access only the "json" property after serialization. ```ts interface SuperJSONResult { json: JSONValue;...

Caching(?) previous data until query returns new data

when I update my useQuery inputs with new filters it instantly sets the data to undefined while the query isLoading. Is there a way to keep the previous data there until the new data returns from the server? Currently there's big flashes in the UI between applications of the filters, as my data length drops to effectively zero then bounced back up again when the new data loads...

How to upload file not use S3 Next js? Please, example

file: course.router.ts / import { CourseSchema } from "~/schema/post.schema"; import { createTRPCRouter, publicProcedure, protectedProcedure,...

Help in deployment

Hey all, I am building an app which is having a 1 . vite-react frontend 2 . trpc-standalone server 3 . react native mobile app all in the same repository...

how to persist the query client?

I want to persist the trpc query client cache, but don't want to create a new query client, I want to use the one trpc already creates. Is this doable?...

How to infer type of a nested object from app router output?

I have a tRPC router than returns a nested object through a db query. It looks like this: ```ts ILessonCommentProps.comments: ({ _count: {...

What's the type of errorFormatter parameter

I wanna know how could i get the type of the errorFormatter parameter, so i can move the errorFormatter logic to another file. Environment: Node v18.15.0...