Skip to content

Commit

Permalink
Fix infinite loop issue due to incorrect dependencies in SearchByMult…
Browse files Browse the repository at this point in the history
…ipleFields (#9970)
  • Loading branch information
rithviknishad authored Jan 14, 2025
1 parent 27fef8d commit 364870b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/Common/SearchByMultipleFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const SearchByMultipleFields: React.FC<SearchByMultipleFieldsProps> = ({
clearinput ? setSearchValue("") : null;
inputRef.current?.focus();
}
}, [clearSearch]);
}, [clearSearch?.value]);

const handleOptionChange = useCallback(
(index: number) => {
Expand Down Expand Up @@ -160,7 +160,7 @@ const SearchByMultipleFields: React.FC<SearchByMultipleFieldsProps> = ({
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;
Expand Down

0 comments on commit 364870b

Please sign in to comment.