Skip to content

Commit

Permalink
add debounce for task assignee modal (Expensify#33282)
Browse files Browse the repository at this point in the history
  • Loading branch information
TMisiukiewicz committed Dec 20, 2023
1 parent eeb1ca3 commit c57889f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/pages/tasks/TaskAssigneeSelectorModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,12 @@ function TaskAssigneeSelectorModal(props) {
}, [props, searchValue, allPersonalDetails, isLoading]);

useEffect(() => {
updateOptions();
}, [searchValue, updateOptions]);
const debouncedSearch = _.debounce(updateOptions, 200);
debouncedSearch();
return () => {
debouncedSearch.cancel();
};
}, [updateOptions]);

const onChangeText = (newSearchTerm = '') => {
setSearchValue(newSearchTerm);
Expand Down

0 comments on commit c57889f

Please sign in to comment.