Skip to content

Commit 590790a

Browse files
committed
address feedback
1 parent 6056f03 commit 590790a

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/useDebouncedCallback.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { useMemo, useRef } from 'react'
22
import useTimeout from './useTimeout'
33
import useEventCallback from './useEventCallback'
4-
import useMounted from './useMounted'
54

65
export interface UseDebouncedCallbackOptions {
76
wait: number
@@ -55,8 +54,6 @@ function useDebouncedCallback<TCallback extends (...args: any[]) => any>(
5554

5655
const isTimerSetRef = useRef(false)
5756
const lastArgsRef = useRef<unknown[] | null>(null)
58-
// Use any to bypass type issue with setTimeout.
59-
const timerRef = useRef<any>(0)
6057

6158
const handleCallback = useEventCallback(fn)
6259

@@ -170,7 +167,7 @@ function useDebouncedCallback<TCallback extends (...args: any[]) => any>(
170167

171168
if (!isTimerSetRef.current) {
172169
isTimerSetRef.current = true
173-
timerRef.current = timeout.set(timerExpired, wait)
170+
timeout.set(timerExpired, wait)
174171
}
175172

176173
return returnValueRef.current

src/useTimeout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MutableRefObject, useEffect, useMemo, useRef, useState } from 'react'
1+
import { MutableRefObject, useEffect, useRef, useState } from 'react'
22
import useMounted from './useMounted'
33

44
/*

0 commit comments

Comments
 (0)