T
tRPC

❓-help

Router/Middleware Chaining in V10

B_braden9/3/2023
Heyo, finally migrating from v9 to v10 after putting it off for a while. Is it just me, or is this migration pretty rough? Really enormous amount of changes and not really a way to do it incrementally. I found interop() didn't work at all, and still not sure if it's going to run after everything. Anyways, in v9, I used router/middleware chaining to establish secure namespaces. That is, every query within, for example, 'A.B.C.', is using middleware established in B. It seems like in v10, middleware has been moved from the router layer to the procedure layer. Do I need to manually rewrite every function in my routers to use this new paradigm, or is there an equivalent?
B_braden9/3/2023
I think found an answer in the form of this Github Discussion. https://github.com/trpc/trpc/discussions/2221 This is... pretty rough. :/ I guess I'll just keep using v9. Not being able to apply middleware to entire namespaces is a huge miss, imo. Will result in a very painful migration, a lot of duplicate code, and weird middleware piping scenarios for my project.

Looking for more? Join the community!