reepicheep
reepicheep
TtRPC
Created by reepicheep on 2/25/2024 in #❓-help
Invalidating query cache irrespective of query params
Hey is it possible to invalidate a query cache without providing parameters? I have a query for example with filter parameters and each filter produces a different cache, but from elsewhere I want to invalidate all of the caches involved in that query. I'm using tRPC 10.38.2 (can't upgrade right now)
2 replies
TtRPC
Created by reepicheep on 10/23/2023 in #❓-help
What is the pattern for unsubscribing from a subscription?
Hi there! I'd like to prevent unnecessary connections to a websocket server across multiple renders. What is the correct pattern to ensure this?
api.live.onNewIncident.useSubscription(undefined, {
onData: () => {
ctx.incidents.all.invalidate().catch(console.error);
},
});
api.live.onNewIncident.useSubscription(undefined, {
onData: () => {
ctx.incidents.all.invalidate().catch(console.error);
},
});
wss.on("connection", (ws) => {
console.log(`++ Connection (${wss.clients.size})`);

ws.once("close", () => {
console.log(`-- Connection (${wss.clients.size})`);
});
});
wss.on("connection", (ws) => {
console.log(`++ Connection (${wss.clients.size})`);

ws.once("close", () => {
console.log(`-- Connection (${wss.clients.size})`);
});
});
5 replies