From 9eea898b4b9880c5a4316630a8ec36e803da3329 Mon Sep 17 00:00:00 2001 From: Shouvik Ghosh Date: Fri, 5 Apr 2024 15:43:34 +0530 Subject: [PATCH] Directly use debounce --- .../mods/modDownloadButton/modDownloadButton.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/mods/modDownloadButton/modDownloadButton.tsx b/src/components/mods/modDownloadButton/modDownloadButton.tsx index 609aeaad..c63475f4 100644 --- a/src/components/mods/modDownloadButton/modDownloadButton.tsx +++ b/src/components/mods/modDownloadButton/modDownloadButton.tsx @@ -38,11 +38,9 @@ const useStyles = createStyles( const ModDownloadButton = ({ gamebananaModId }: ModDownloadButtonProps) => { const { downloadUrl } = useGamebananaModDownloadUrl({ gamebananaModId }); const [opened, { close, open }] = useDisclosure(false); + // Since there is a gap between the link and the popover, + // debouncing prevents the popover from closing when we move from the link to popover. const [debouncedOpened] = useDebouncedValue(opened, 100); - // We use this so that the popover opens instantly, but takes some time to close. - // Since there is a gap between the link and the popover it prevents the popover from closing - // when we move from the link to popover. - const openPopover = opened || debouncedOpened; const { classes } = useStyles(); @@ -51,7 +49,7 @@ const ModDownloadButton = ({ gamebananaModId }: ModDownloadButtonProps) => {