thecahnartist
thecahnartist2w ago

Turn off batching for some queries?

Hiya, I have a use case where I want to set headers on specific queries (specifically cache-control private for authenticated data that's requested frequently by the client across page reloads) but because of batching, I'd need to make sure requests to these queries are never batched so the headers only refer to the one query at a time. Are there any tricks for this? Or any better approaches for my use case?
2 Replies
Nick
Nick2w ago
You could use a splitLink to decide if a request goes into a batch link or a normal link I don’t believe there’s currently a way to control this at a query level but PRs would be welcome
Alex / KATT 🐱
Split Link | tRPC
splitLink is a link that allows you to branch your link chain's execution depending on a given condition. Both the true and false branches are required. You can provide just one link, or multiple links per branch via an array.

Did you find this page helpful?