Skip to content

Commit 9ae2a1a

Browse files
committed
1 parent 92545cc commit 9ae2a1a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

docs/react/guides/optimistic-updates.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ This is the simpler variant, as it doesn't interact with the cache directly.
1515
mutationFn: (newTodo: string) => axios.post('/api/data', { text: newTodo }),
1616
// make sure to _return_ the Promise from the query invalidation
1717
// so that the mutation stays in `pending` state until the refetch is finished
18-
onSettled: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),
18+
onSettled: async () => {
19+
return await queryClient.invalidateQueries({ queryKey: ['todos'] })
20+
},
1921
})
2022
```
2123
[//]: # 'ExampleUI1'

0 commit comments

Comments
 (0)