Skip to content

Commit

Permalink
fix issue when paginating with search
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad committed Nov 10, 2022
1 parent 5439593 commit bf8b16f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Components/Form/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ const SearchInput = ({
const [value, setValue] = useState(() => props.value);
useEffect(() => setValue(props.value || undefined), [props.value]);
useEffect(() => {
if (value !== undefined) {
if (value !== props.value) {
const timeoutId = setTimeout(
() => onChange && onChange({ name, value: value || "" }),
debouncePeriod
);
return () => clearTimeout(timeoutId);
}
}, [value, debouncePeriod, name, onChange]);
}, [value, debouncePeriod, name, onChange, props.value]);

// Focus hotkey related
const ref = createRef<HTMLInputElement>();
Expand Down

0 comments on commit bf8b16f

Please sign in to comment.