Gabriel
How can I automatically use react's cache with tRPC on server side?
I have this in my repo:
But, now I need to understand, how should I export the actual functions from the api caller so they are all cached with react's cache?
I of course could do something like this
But I would prefer if I could get an instance of api where all of my endpoints will be using the cache automatically. something like
2 replies
Why deprecate experimental_standaloneMiddleware?
I am reading https://trpc.io/docs/server/middlewares#experimental-standalone-middlewares, but it's still not clear to me why experimental_standaloneMiddleware was deprecated. It says we can use .concat() to use "standalone" middlewares. However, I don't see how they are related exactly?
The example shows we can use a plugin. This would take in a new procedure to do concating of procedures.
But this is not exactly what I want. In my code I have this:
Doing this via concat() feels unnatural. I just want to define a middleware that I can use in multiple procedures where my session is not null (protected context). What is the recommended way of doing this?
5 replies