From 364870be387c0582d5aee3c7cce24ffddb631650 Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Tue, 14 Jan 2025 17:29:47 +0000 Subject: [PATCH] Fix infinite loop issue due to incorrect dependencies in SearchByMultipleFields (#9970) --- src/components/Common/SearchByMultipleFields.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Common/SearchByMultipleFields.tsx b/src/components/Common/SearchByMultipleFields.tsx index cde64c75031..7aec153408d 100644 --- a/src/components/Common/SearchByMultipleFields.tsx +++ b/src/components/Common/SearchByMultipleFields.tsx @@ -89,7 +89,7 @@ const SearchByMultipleFields: React.FC = ({ clearinput ? setSearchValue("") : null; inputRef.current?.focus(); } - }, [clearSearch]); + }, [clearSearch?.value]); const handleOptionChange = useCallback( (index: number) => { @@ -160,7 +160,7 @@ const SearchByMultipleFields: React.FC = ({ if (selectedOption.value !== searchValue) { onSearch(selectedOption.key, searchValue); } - }, [searchValue, selectedOption.key, selectedOption.value, onSearch]); + }, [searchValue]); const handleSearchChange = useCallback((event: EventType) => { const value = "target" in event ? event.target.value : event.value;