Debounced auto-submit for GIF search field

This commit is contained in:
Lim Chee Aun 2024-04-17 08:26:35 +08:00
parent 55ad6500bc
commit b9058c6e3d

View file

@ -2374,6 +2374,10 @@ function GIFPickerModal({ onClose = () => {}, onSelect = () => {} }) {
qRef.current?.focus(); qRef.current?.focus();
}, []); }, []);
const debouncedOnInput = useDebouncedCallback(() => {
fetchGIFs({ offset: 0 });
}, 1000);
return ( return (
<div id="gif-picker-sheet" class="sheet"> <div id="gif-picker-sheet" class="sheet">
{!!onClose && ( {!!onClose && (
@ -2400,6 +2404,7 @@ function GIFPickerModal({ onClose = () => {}, onSelect = () => {} }) {
autocapitalize="off" autocapitalize="off"
spellCheck="false" spellCheck="false"
dir="auto" dir="auto"
onInput={debouncedOnInput}
/> />
<input <input
type="image" type="image"