useDedupe callback (#4855)

zio/stable
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
1 changed files with 2 additions and 2 deletions

View File

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