What Is a Data Mutation?
A data mutation is any operation that changes server-side state, such as creating, updating, or deleting a record, in contrast to a read-only query. Because a mutation alters underlying data, it typically invalidates cached copies that no longer reflect reality. Client libraries model mutations separately from queries for this reason.
Why it matters
Distinguishing mutations from reads clarifies which operations must trigger cache invalidation and refetching. It is the foundation of patterns like optimistic UI and tag-based revalidation.
Related guides
What Is a Revalidation Tag?A revalidation tag is a label on cached data so that, after a mutation, an app can invalidate exactly the ent…
What Is Optimistic UI?Optimistic UI updates the interface at once as if an action succeeded, before the server confirms, then recon…
What Is a Server Action?A server action is a server-side function a client can invoke directly to mutate data, letting forms run back…