You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working with headers (like having something in the middleware that sets a header for the request, which tRPC is picking up – let's say auth), and then switching the header, the experimental_createTRPCNextAppDirClient method is caching this way to hard. The headers are not included in the caching mechanism.
So i.e. in my application it's like this:
I have a middleware, which sets the ID of the tenant, based on the id param from the route (this is because tRPC doesn't know all the time, where I am calling the API from).
Now, I am fetching the header in the headers() method, that I am supplying to the experimental_createTRPCNextAppDirClient call.
See, that my header is still not changed, but the call is not being made at all (cache is being used).
This is the case for like 1 minute, after which (I actually don't know why) the cache is being cleared, and the request is being done normally.
I think the cache shouldn't be there on a "client"-side, but on the link-side.
Provide environment information
Not needed in this case.
Describe the bug
When working with headers (like having something in the middleware that sets a header for the request, which tRPC is picking up – let's say auth), and then switching the header, the
experimental_createTRPCNextAppDirClient
method is caching this way to hard. The headers are not included in the caching mechanism.So i.e. in my application it's like this:
id
param from the route (this is because tRPC doesn't know all the time, where I am calling the API from).headers()
method, that I am supplying to theexperimental_createTRPCNextAppDirClient
call.I think the cache shouldn't be there on a "client"-side, but on the link-side.
Related: #5625
Link to reproduction
Not yet...
To reproduce
Working on a reproduction...
Additional information
No response
👨👧👦 Contributing
Funding
The text was updated successfully, but these errors were encountered: