Theo's Typesafe CultTTC
Theo's Typesafe Cult4y ago
11 replies
karlosos

trpc v10 Invalidating all queries from given router

Is it possible to invalidate all the queries under given router? Similarly as it is in react-query: https://tanstack.com/query/v4/docs/guides/query-invalidation

Can I use query-client in trpc in the same way?
Waiting for queries to become stale before they are fetched again doesn't always work, especially when you know for a fact that a query's data is out of date because of something the user has done. For that purpose, the QueryClient has an invalidateQueries method that lets you intelligently mark queries as stale and potentially refetch them too...
Query Invalidation | TanStack Query Docs
Was this page helpful?