TanStackT
TanStack6mo ago
3 replies
opposite-copper

Retry next in middleware

Hey! so just saw we now have the ability to access the router instance (and thus the root context) from a client function middleware, which is awesome, thank you!!

This reminded me of the other QoL feature regarding middlewares I'd love to see: retrying the next() handler. My use case is to add retry logic for certain kinds of errors (in my case on the client, but it'd apply on the server too) that is encapsulated in the server fn, without having to move that logic up to say the query client.

Currently, it seems calling next multiple times doesn't work, the successive calls just return undefined
Was this page helpful?