Skip to content

Commit 18091fe

Browse files
authored
docs: onMutate should be async (TanStack#1585)
Since we await in the function body, onMutate should be an async function.
1 parent 6b2bb21 commit 18091fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/src/pages/guides/mutations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ const queryClient = new QueryClient()
216216
// Define the "addTodo" mutation
217217
queryClient.setMutationDefaults('addTodo', {
218218
mutationFn: addTodo,
219-
onMutate: variables => {
219+
onMutate: async (variables) => {
220220
// Cancel current queries for the todos list
221221
await queryClient.cancelQueries('todos')
222222

0 commit comments

Comments
 (0)