Skip to content

Commit 70ffd2c

Browse files
authored
refactor: rename from waitForDedupingInterval to waitForNextTick (#960)
1 parent ef47355 commit 70ffd2c

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

test/use-swr-focus.test.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { useState } from 'react'
33
import useSWR from '../src'
44
import { sleep } from './utils'
55

6-
const waitForDedupingInterval = async () => await act(() => sleep(1))
6+
const waitForNextTick = async () => await act(() => sleep(1))
77

88
describe('useSWR - focus', () => {
99
it('should revalidate on focus by default', async () => {
@@ -22,7 +22,7 @@ describe('useSWR - focus', () => {
2222
// mount
2323
await screen.findByText('data: 0')
2424

25-
await waitForDedupingInterval()
25+
await waitForNextTick()
2626
// trigger revalidation
2727
fireEvent.focus(window)
2828
await screen.findByText('data: 1')
@@ -45,7 +45,7 @@ describe('useSWR - focus', () => {
4545
// mount
4646
await screen.findByText('data: 0')
4747

48-
await waitForDedupingInterval()
48+
await waitForNextTick()
4949
// trigger revalidation
5050
fireEvent.focus(window)
5151
// should not be revalidated
@@ -70,7 +70,7 @@ describe('useSWR - focus', () => {
7070
// mount
7171
await screen.findByText('data: 0')
7272

73-
await waitForDedupingInterval()
73+
await waitForNextTick()
7474
// trigger revalidation
7575
fireEvent.focus(window)
7676
// data should not change
@@ -83,13 +83,13 @@ describe('useSWR - focus', () => {
8383
// data should update
8484
await screen.findByText('data: 1')
8585

86-
await waitForDedupingInterval()
86+
await waitForNextTick()
8787
// trigger revalidation
8888
fireEvent.focus(window)
8989
// data should update
9090
await screen.findByText('data: 2')
9191

92-
await waitForDedupingInterval()
92+
await waitForNextTick()
9393
// change revalidateOnFocus to false
9494
fireEvent.click(container.firstElementChild)
9595
// trigger revalidation
@@ -120,7 +120,7 @@ describe('useSWR - focus', () => {
120120
// mount
121121
await screen.findByText('data: 0')
122122

123-
await waitForDedupingInterval()
123+
await waitForNextTick()
124124
// trigger revalidation
125125
fireEvent.focus(window)
126126
// still in throttling interval
@@ -159,7 +159,7 @@ describe('useSWR - focus', () => {
159159
// mount
160160
await screen.findByText('data: 0')
161161

162-
await waitForDedupingInterval()
162+
await waitForNextTick()
163163
// trigger revalidation
164164
fireEvent.focus(window)
165165
// wait for throttle interval
@@ -168,7 +168,7 @@ describe('useSWR - focus', () => {
168168
fireEvent.focus(window)
169169
await screen.findByText('data: 2')
170170

171-
await waitForDedupingInterval()
171+
await waitForNextTick()
172172
// increase focusThrottleInterval
173173
fireEvent.click(container.firstElementChild)
174174
// wait for throttle interval

test/use-swr-local-mutation.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ describe('useSWR - local mutation', () => {
181181
//mount
182182
await screen.findByText('data: 0')
183183

184-
// wait for dedupingInterval
184+
// wait for the next tick
185185
await act(() => sleep(1))
186186
await act(() => {
187187
// mutate and revalidate

0 commit comments

Comments
 (0)