We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 52042e9 commit 4855cf7Copy full SHA for 4855cf7
examples/optimistic-updates/pages/api/data.js
@@ -1,7 +1,7 @@
1
const items = []
2
3
export default async (req, res) => {
4
- await new Promise(r => setTimeout(r, 500))
+ await new Promise(r => setTimeout(r, 1000))
5
6
if (req.method === 'POST') {
7
const { text } = req.body
examples/optimistic-updates/pages/index.js
@@ -17,6 +17,8 @@ export default () => {
17
// the old value and return it so that it's accessible in case of
18
// an error
19
onMutate: text => {
20
+ queryCache.cancelQueries('todos')
21
+
22
const previousValue = queryCache.getQueryData('todos')
23
24
queryCache.setQueryData('todos', old => ({
0 commit comments