From c57889f4e8f85540c39518c4ce9fb10e3b7382a7 Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Wed, 20 Dec 2023 09:38:36 +0100 Subject: [PATCH] add debounce for task assignee modal (#33282) --- src/pages/tasks/TaskAssigneeSelectorModal.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pages/tasks/TaskAssigneeSelectorModal.js b/src/pages/tasks/TaskAssigneeSelectorModal.js index cee84cdd1a93..8ef9bf1414f7 100644 --- a/src/pages/tasks/TaskAssigneeSelectorModal.js +++ b/src/pages/tasks/TaskAssigneeSelectorModal.js @@ -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);