tRPCttRPC
Powered by
santiS
tRPC•3y ago•
3 replies
santi

Bug where 2 requests are fired at once. TRPC batches them. Can I cancel the 2nd via ProcedureOption?

Hey all. I have a bug where my app fires two identical requests at the same time. This happens do to some weird upstream auth listener logic. Ideally TRPC can help me mitigate this. I want to configure
ProcedureOption
ProcedureOption
such that it doesn't batch, but rather only lets the first request to go through. Is this possible?
const updatedCartItems = await trpcClient.user.cart.replaceCartOnAuthLoaded.mutate(
  {
    anonymousCartItems,
  },
  {
    onlyOneAtATime: true,
  },
)
const updatedCartItems = await trpcClient.user.cart.replaceCartOnAuthLoaded.mutate(
  {
    anonymousCartItems,
  },
  {
    onlyOneAtATime: true,
  },
)
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Where i can read a journal about tRPC ?
cocoCcoco / ❓-help
3y ago
Can trpc be used when both app and pages router is used at once ?
HussamHHussam / ❓-help
15mo ago
I think i found an TRPC BUG
AutumnLightAAutumnLight / ❓-help
3y ago