Skip to content

Commit 570c9b7

Browse files
fix: clear timeouts on anchor unmount
1 parent 349e5a1 commit 570c9b7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/components/Tooltip/Tooltip.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,9 @@ const Tooltip = ({
276276
return
277277
}
278278
handleShow(false)
279+
if (tooltipShowDelayTimerRef.current) {
280+
clearTimeout(tooltipShowDelayTimerRef.current)
281+
}
279282
}
280283

281284
const handleEsc = (event: KeyboardEvent) => {
@@ -403,6 +406,12 @@ const Tooltip = ({
403406
setRendered(false)
404407
handleShow(false)
405408
setActiveAnchor(null)
409+
if (tooltipShowDelayTimerRef.current) {
410+
clearTimeout(tooltipShowDelayTimerRef.current)
411+
}
412+
if (tooltipHideDelayTimerRef.current) {
413+
clearTimeout(tooltipHideDelayTimerRef.current)
414+
}
406415
return true
407416
}
408417
return false

0 commit comments

Comments
 (0)