@@ -3,7 +3,7 @@ import React, { useState } from 'react'
3
3
import useSWR from '../src'
4
4
import { sleep } from './utils'
5
5
6
- const waitForDedupingInterval = async ( ) => await act ( ( ) => sleep ( 1 ) )
6
+ const waitForNextTick = async ( ) => await act ( ( ) => sleep ( 1 ) )
7
7
8
8
describe ( 'useSWR - focus' , ( ) => {
9
9
it ( 'should revalidate on focus by default' , async ( ) => {
@@ -22,7 +22,7 @@ describe('useSWR - focus', () => {
22
22
// mount
23
23
await screen . findByText ( 'data: 0' )
24
24
25
- await waitForDedupingInterval ( )
25
+ await waitForNextTick ( )
26
26
// trigger revalidation
27
27
fireEvent . focus ( window )
28
28
await screen . findByText ( 'data: 1' )
@@ -45,7 +45,7 @@ describe('useSWR - focus', () => {
45
45
// mount
46
46
await screen . findByText ( 'data: 0' )
47
47
48
- await waitForDedupingInterval ( )
48
+ await waitForNextTick ( )
49
49
// trigger revalidation
50
50
fireEvent . focus ( window )
51
51
// should not be revalidated
@@ -70,7 +70,7 @@ describe('useSWR - focus', () => {
70
70
// mount
71
71
await screen . findByText ( 'data: 0' )
72
72
73
- await waitForDedupingInterval ( )
73
+ await waitForNextTick ( )
74
74
// trigger revalidation
75
75
fireEvent . focus ( window )
76
76
// data should not change
@@ -83,13 +83,13 @@ describe('useSWR - focus', () => {
83
83
// data should update
84
84
await screen . findByText ( 'data: 1' )
85
85
86
- await waitForDedupingInterval ( )
86
+ await waitForNextTick ( )
87
87
// trigger revalidation
88
88
fireEvent . focus ( window )
89
89
// data should update
90
90
await screen . findByText ( 'data: 2' )
91
91
92
- await waitForDedupingInterval ( )
92
+ await waitForNextTick ( )
93
93
// change revalidateOnFocus to false
94
94
fireEvent . click ( container . firstElementChild )
95
95
// trigger revalidation
@@ -120,7 +120,7 @@ describe('useSWR - focus', () => {
120
120
// mount
121
121
await screen . findByText ( 'data: 0' )
122
122
123
- await waitForDedupingInterval ( )
123
+ await waitForNextTick ( )
124
124
// trigger revalidation
125
125
fireEvent . focus ( window )
126
126
// still in throttling interval
@@ -159,7 +159,7 @@ describe('useSWR - focus', () => {
159
159
// mount
160
160
await screen . findByText ( 'data: 0' )
161
161
162
- await waitForDedupingInterval ( )
162
+ await waitForNextTick ( )
163
163
// trigger revalidation
164
164
fireEvent . focus ( window )
165
165
// wait for throttle interval
@@ -168,7 +168,7 @@ describe('useSWR - focus', () => {
168
168
fireEvent . focus ( window )
169
169
await screen . findByText ( 'data: 2' )
170
170
171
- await waitForDedupingInterval ( )
171
+ await waitForNextTick ( )
172
172
// increase focusThrottleInterval
173
173
fireEvent . click ( container . firstElementChild )
174
174
// wait for throttle interval
0 commit comments