Skip to content

Commit

Permalink
Debounced auto-submit for GIF search field
Browse files Browse the repository at this point in the history
  • Loading branch information
cheeaun committed Apr 17, 2024
1 parent 55ad650 commit b9058c6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/compose.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2374,6 +2374,10 @@ function GIFPickerModal({ onClose = () => {}, onSelect = () => {} }) {
qRef.current?.focus();
}, []);

const debouncedOnInput = useDebouncedCallback(() => {
fetchGIFs({ offset: 0 });
}, 1000);

return (
<div id="gif-picker-sheet" class="sheet">
{!!onClose && (
Expand All @@ -2400,6 +2404,7 @@ function GIFPickerModal({ onClose = () => {}, onSelect = () => {} }) {
autocapitalize="off"
spellCheck="false"
dir="auto"
onInput={debouncedOnInput}
/>
<input
type="image"
Expand Down

0 comments on commit b9058c6

Please sign in to comment.