Skip to content

Commit bed7c74

Browse files
committed
fix(TooltipV2): change type of timeoutRef
1 parent 15ce545 commit bed7c74

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/react/src/TooltipV2/Tooltip.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export const Tooltip = React.forwardRef(
214214

215215
const [isPopoverOpen, setIsPopoverOpen] = useState(false)
216216

217-
const timeoutRef = React.useRef(0)
217+
const timeoutRef = React.useRef<number | null>(null)
218218

219219
const {safeSetTimeout, safeClearTimeout} = useSafeTimeout()
220220

@@ -377,7 +377,10 @@ export const Tooltip = React.forwardRef(
377377
}, 50)
378378
},
379379
onMouseLeave: (event: React.MouseEvent) => {
380-
safeClearTimeout(timeoutRef.current)
380+
if (timeoutRef.current) {
381+
safeClearTimeout(timeoutRef.current)
382+
timeoutRef.current = null
383+
}
381384
closeTooltip()
382385
child.props.onMouseLeave?.(event)
383386
},

0 commit comments

Comments
 (0)