Debounced auto-submit for GIF search field

pull/489/head 2024.04.17.b6cf53c
Lim Chee Aun 2024-04-17 08:26:35 +08:00
rodzic 55ad6500bc
commit b9058c6e3d
1 zmienionych plików z 5 dodań i 0 usunięć

Wyświetl plik

@ -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"