HussamH
tRPC3y ago
Hussam

Suggested way to invalidate queries on a component that is used on multiple pages.

Please suggest me a way I can handle the following situation in the best possinle manner.

Coinsider a Component
  • used in multiple pages
  • has mutations, which requires query invalidation on other components of the page.
  • the query invalidation differes from page to page, if we invalidate everything that will be waste of network request.
  • I dont always have the key to invalidate the cache
    .invalidate({ id: input.id }) // input.id is not known 
solutions tried
  • conditionally do invalidtion based on route
Was this page helpful?