avoiding multiple API calls on selecting same role for a user under manage users

This commit is contained in:
Ankita Kinger 2022-02-01 18:06:10 +05:30
parent df1ee35992
commit 34da849cbd

View File

@ -97,9 +97,11 @@ function TableDropdown(props: DropdownProps) {
}, [props.selectedIndex]);
const optionSelector = (index: number) => {
setSelectedIndex(index);
setSelectedOption(props.options[index]);
props.onSelect && props.onSelect(props.options[index]);
if (index !== selectedIndex) {
setSelectedIndex(index);
setSelectedOption(props.options[index]);
props.onSelect && props.onSelect(props.options[index]);
}
setIsDropdownOpen(false);
};