diff --git a/docs/docs/basics/OptimisticUpdates.md b/docs/docs/basics/OptimisticUpdates.md
index 83bbcbe..e70dd11 100644
--- a/docs/docs/basics/OptimisticUpdates.md
+++ b/docs/docs/basics/OptimisticUpdates.md
@@ -3,57 +3,54 @@ title: Optimistic Updates
sidebar_position: 10
---
-### What is Optimistic UI Update?
-
> In an optimistic update the UI behaves as though a change was successfully completed before receiving confirmation from the server that it actually was - it is being optimistic that it will eventually get the confirmation rather than an error. This allows for a more responsive user experience.
->
+
> Source: https://stackoverflow.com/a/33009713/13292290
-# Update from Mutation Response
+## Update from Mutation Response
-When dealing with mutations that **update** documents/tables on the server, it's common for the new data to be automatically returned in the response of the `mutation`. Instead of refetching any queries for that item and wasting a network call for data we already have, we can take advantage of the object returned by the mutation function and update the existing query with the new data immediately using the `QueryBowl`'s `setQueryData` method:
+When dealing with mutations that **update** documents/tables on the server, it's common for the new data to be automatically returned in the response of the `mutation`. Instead of refreshing any queries for that item and wasting a network call for data we already have, we can take advantage of the object returned by the mutation function and update the existing query with the new data immediately using the `Query.setData` method.
```dart
-return MutationBuilder(
- job: mutationJob,
- onSuccess: (data) {
- QueryBowl.of(context)
- .setQueryData(successJob.queryKey, (_oldData) {
- return data;
- });
+final queryClient = QueryBowl.of(context);
+
+return MutationBuilder(
+ 'add-todo',
+ (todo)=> api.addTodo(todo)
+ onSuccess: (data, recoveryData) {
+ // suppose a query with key 'todos' exists
+ final query = queryClient.getQuery('todos');
+ if(query == null) return;
+ query.setData([...query.data, data]);
}
);
```
-# onMutate Event Callback
-
-`onMutate` callback of `MutationBuilder` runs before the mutation task defined in the `MutationJob` is executed. It gives access to mutation variables in the Callback too thus queries or any other source of data can be updated with predicted data to make user experience a lot smoother
+## onMutate Callback
+`onMutate` callback of `MutationBuilder` runs before the mutation is executed. It gives access to mutation variables in the Callback thus queries or any other source of data can be updated with predicted data to make the UI more instantaneous.
```dart
-return MutationBuilder(
- job: mutationJob,
- onMutate: (variable) {
- final data = QueryBowl.of(context).getQuery(successJob.queryKey)?.data;
- QueryBowl.of(context)
- .setQueryData