From babef456cf3189832de6465bce98cb7b44fb8639 Mon Sep 17 00:00:00 2001 From: Kavin Venkatachalam Date: Wed, 26 Feb 2025 16:02:02 +0530 Subject: [PATCH] hotfix: expose the proper value while mounting the component --- frontend/src/Editor/Components/RadioButton.jsx | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/frontend/src/Editor/Components/RadioButton.jsx b/frontend/src/Editor/Components/RadioButton.jsx index 4e77f2c928..360efab4af 100644 --- a/frontend/src/Editor/Components/RadioButton.jsx +++ b/frontend/src/Editor/Components/RadioButton.jsx @@ -1,4 +1,4 @@ -import React, { useEffect, useRef, useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { v4 as uuidv4 } from 'uuid'; export const RadioButton = function RadioButton({ @@ -12,8 +12,8 @@ export const RadioButton = function RadioButton({ darkMode, dataCy, }) { - const isInitialRender = useRef(true); const { label, value, values, display_values } = properties; + const { visibility, disabledState, activeColor, boxShadow } = styles; const textColor = darkMode && styles.textColor === '#000' ? '#fff' : styles.textColor; const [checkedValue, setValue] = useState(() => value); @@ -37,12 +37,6 @@ export const RadioButton = function RadioButton({ fireEvent('onSelectionChange'); } - useEffect(() => { - if (isInitialRender.current) return; - setExposedVariable('value', value); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - useEffect(() => { const exposedVariables = { value: value, @@ -51,9 +45,8 @@ export const RadioButton = function RadioButton({ }, }; setExposedVariables(exposedVariables); - isInitialRender.current = false; // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); + }, [value]); return (