From 786024629c5f610900e5a78ed33ae42283d2d153 Mon Sep 17 00:00:00 2001 From: Kartik Gupta Date: Fri, 8 Nov 2024 11:22:02 +0530 Subject: [PATCH] fix dropdown select option function stale closure --- frontend/src/Editor/Components/DropDown.jsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontend/src/Editor/Components/DropDown.jsx b/frontend/src/Editor/Components/DropDown.jsx index 723cb34c3a..64778c0256 100644 --- a/frontend/src/Editor/Components/DropDown.jsx +++ b/frontend/src/Editor/Components/DropDown.jsx @@ -145,6 +145,16 @@ export const DropDown = function DropDown({ // eslint-disable-next-line react-hooks/exhaustive-deps }, []); + useEffect(() => { + const exposedVariables = { + selectOption: async function (value) { + selectOption(value); + }, + }; + + setExposedVariables(exposedVariables); + }, [JSON.stringify(properties.values)]); + useEffect(() => { let newValue = undefined; let index = null;