How to skip batching for a single trpc query in trpc v10?
I want to skip batching for only one query. But I am not able to figure out how to do that. As in the trpc v 10 docs I can see that we can completely skip batching, but I can't figure out how to skip batching for a single query.
In trpc v9 we can do it like this
const postsQuery = trpc.useQuery(['posts'], {
context: {
skipBatch: true,
},
});
Can someone please guide me in the right direction please?
2 Replies
Looks like it’s a bit more involved now https://trpc.io/docs/links/splitLink#disable-batching-for-certain-requests
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.
@jingleberry thanks a ton man