From b9058c6e3ded3e871fec2e4f68ac3b4cfbe0e0b8 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Wed, 17 Apr 2024 08:26:35 +0800 Subject: [PATCH] Debounced auto-submit for GIF search field --- src/components/compose.jsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/compose.jsx b/src/components/compose.jsx index 6506d73..4508c0a 100644 --- a/src/components/compose.jsx +++ b/src/components/compose.jsx @@ -2374,6 +2374,10 @@ function GIFPickerModal({ onClose = () => {}, onSelect = () => {} }) { qRef.current?.focus(); }, []); + const debouncedOnInput = useDebouncedCallback(() => { + fetchGIFs({ offset: 0 }); + }, 1000); + return (
{!!onClose && ( @@ -2400,6 +2404,7 @@ function GIFPickerModal({ onClose = () => {}, onSelect = () => {} }) { autocapitalize="off" spellCheck="false" dir="auto" + onInput={debouncedOnInput} />