mike_buildsM
tRPC8mo ago
5 replies
mike_builds

Caching a middleware response during batching

Hey there, I do some authorisation checks in middleware (procedure) - the authorisation check is a little bit slow. I'm facing an issue that when the page initially loads, there is a significant amount of TRPC requests sent as a batch and although it's sent as a batch, each path still runs the procedure.

Is there a way to cache the procedure response for the same request, or use the same procedure output for multiple requests during a batch?
Was this page helpful?