fixing app freeze issue while giving empty array as default value (#2515)

This commit is contained in:
Kiran Ashok 2022-03-31 15:27:24 +05:30 committed by GitHub
parent 1d67752aca
commit 4429cde723
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,13 +43,18 @@ export const DropDown = function DropDown({
useEffect(() => {
let newValue = undefined;
if (values?.includes(value)) newValue = value;
if (values?.includes(value)) {
newValue = value;
}
setCurrentValue(newValue);
setExposedVariable('value', newValue);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [value]);
useEffect(() => {
setExposedVariable('value', currentValue);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [currentValue]);
useEffect(() => {
let newValue = undefined;
if (values?.includes(currentValue)) newValue = currentValue;