useDedupe callback (#4855)

This commit is contained in:
GSMT 2024-07-31 00:19:23 +02:00 committed by GitHub
parent 8ddb28d3c5
commit c3e77b56ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,7 +3,7 @@ import React from 'react'
export const useDedupe = () => {
const canDo = React.useRef(true)
return React.useRef((cb: () => unknown) => {
return React.useCallback((cb: () => unknown) => {
if (canDo.current) {
canDo.current = false
setTimeout(() => {
@ -13,5 +13,5 @@ export const useDedupe = () => {
return true
}
return false
}).current
}, [])
}