From b83945b30ce071abbac64488d8f5d028f2a706ac Mon Sep 17 00:00:00 2001 From: Rajgupta36 Date: Sun, 26 May 2024 17:15:09 +0530 Subject: [PATCH] implement debouncing --- src/components/videothumbnail.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/videothumbnail.tsx b/src/components/videothumbnail.tsx index 0403dde6e..710196b81 100644 --- a/src/components/videothumbnail.tsx +++ b/src/components/videothumbnail.tsx @@ -97,12 +97,16 @@ const VideoThumbnail = ({ setVideoUrl(null); }; }, [contentId]); - + let hoverTimeout: any; const handleMouseEnter = () => { + hoverTimeout = setTimeout(() => { + setHover(true); + }, 500); setHover(true); }; const handleMouseLeave = () => { + clearTimeout(hoverTimeout); setHover(false); }; const handlePlayerReady = async (player: Player) => {