Skip to content
public-library›Rules›TanStack Query›Invalidate or update every query a mutation changes

Invalidate or update every query a mutation changes

After a mutation succeeds, invalidate every cached query whose data it may have changed, or write the server's response into the cache when it contains the complete new value. Use the narrowest key prefix that still covers every affected query.

In the full rule