Call multiple TRPC endpoints from onSuccess()?

I would like to create an API chain for analysing a geographic area where one successful API call can lead to multiple new API's being called to render the components in the right orders for the user. This works really well for single API calls, but when combining multiple of them together to be triggered at a onSuccess() call, the trpc combines them all together instead of taking them one by one. Does anyone know how to solve this?
No description
No description
AK
Alex / KATT πŸ±β€’219d ago
you're using batching
AK
Alex / KATT πŸ±β€’219d ago
HTTP Batch Link | tRPC
httpBatchLink is a terminating link that batches an array of individual tRPC operations into a single HTTP request that's sent to a single tRPC procedure.
AK
Alex / KATT πŸ±β€’219d ago
Split Link | tRPC
splitLink is a link that allows you to branch your link chain's execution depending on a given condition. Both the true and false branches are required. You can provide just one link, or multiple links per branch via an array.
S
sachinβ€’219d ago
you should be able to just await them in order
P
peternovakβ€’219d ago
Thanks @alexkatt , this httpBatchLink was exactly the documentation I was looking for!! How would that kind of structure look like @sachinraja ? Keen to give it a try!
S
sachinβ€’219d ago
sorry i misunderstood what you were asking - alex's solution works for what you want here why don’t you want them to be batched though?
P
peternovakβ€’219d ago
The polygon that I am sending from my frontend is about 300kb, so if I batch these endpoints together I am hitting the cap of 1MB max limit of TRPC (and I didn't manage to figure out how to increase it)
More Posts
How to set sizeLimit > 1MB (to solve 413 error)?Hi all, I am trying out the T3 stack where I want to send area polygons given by the user to my NexHow to manage server to server communicationWould managing headers this way work in nextjs as server to server communication? or does next managReplacing the dot notation in URLs with forward slash `/` ?is there a way to replace the dot separation with a forward slash instead ? so instead of `/api/tWhich one method should I use for creating trpc for server componetns in Nextjs 13 App dirHi which one I should use experimental_createTRPCNextAppDirServer or createTRPCProxyClient when it cCan someone explain to me the use of tRPC in server components?I can really see the need for tRPC in client components but can someone explain to me how you would Error-Boundary and TRPCIs there a nice way to catch errors from TRPC at a global level and bubble them into a simple alert Type errors in lambda integrationI really don't know where to start with this error.... I'm going to be integrating tRPC into a lambHybrid application with offline and online mode setup with tRPCHi, I was wondering if I could setup tRPC in way that one http link is using local API (for offline query with no input reports errori have a simple router with a list procedure that takes no input and just does a .query() it used tNext cookies() not being set on Mutation in App Dir (T3 Turbo)Trying to set cookies inside TRPC using Nextjs App Router, using the T3 Turbo setup. Setting cookietRPC error in app Router (undefined headers)I use the tRPC file structure from Jack Herringtons video I added clerk auth for protected routes anBad request in prod but works fine in devin prod I am getting `BAD REQUEST`hey is there any way to integrate or implement machine learning / ai in trpcSpecifically for next.js or tensorflow?How to serve files with trpc?Is is possible to serve files with trpc? E.g., by creating a middleware and returning directly from tRPC in Next without api rotesHello! I have NextJS app that gets data in gSP using some third-party client. This data comes untypegetting the progress of a trpc queryHello, I want to be able to stream the progress of a trpc client query call, so I can link it to a pwrapper on useMutation (and another for useQuery) for creating multiple hookshi i want to create a wrapper for my router, basically I would like to achive somethink like that useQuery returning old data with new paramsI have a react component that takes in a date range and calculates a users net worth (sums up all asCalling a tRPC service from another tRPC serviceI have 2 services (App1 and Service2) App1 is client facing and uses trpc well But occasionally App1charset=utf8 results in empty inputI'm using trpc-openapi and some of our customers are using Zapier to communicate with it. Zapier us