Problem: Cache invalidation is hard
Problem: Cache invalidation is hard.
Example: One of my clients uses React Query heavily. We have 100's of query keys, and many are quite complex. When a mutation occurs, we often need to invalidate multiple related queries. So, it's easy to forget to invalidate related queries when a mutation occurs.
Solution: Colocate related queries in the same file and centralize keys at the top. This helps us reuse keys, and helps us find related queries when writing a new mutation. (Example below)
Anyone else have tips in this area? cc @TkDodo
