From 4429cde723c92fffdfcf105aba28515154531331 Mon Sep 17 00:00:00 2001 From: Kiran Ashok Date: Thu, 31 Mar 2022 15:27:24 +0530 Subject: [PATCH] fixing app freeze issue while giving empty array as default value (#2515) --- frontend/src/Editor/Components/DropDown.jsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/src/Editor/Components/DropDown.jsx b/frontend/src/Editor/Components/DropDown.jsx index 7c8f4d8902..0ff4232619 100644 --- a/frontend/src/Editor/Components/DropDown.jsx +++ b/frontend/src/Editor/Components/DropDown.jsx @@ -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;