From 4aa2e406eb2e001bbe0414c1a171e44c2eca4176 Mon Sep 17 00:00:00 2001 From: Shaurya Sharma <79473274+shaurya-sharma064@users.noreply.github.com> Date: Tue, 23 Jul 2024 10:37:22 +0530 Subject: [PATCH] fix: Textarea exposed variable not updated on app load (#10327) * fix: Textarea exposed variable not updated on app load * fix: Textarea exposed variable not updated on app load --------- Co-authored-by: Johnson Cherian --- frontend/src/Editor/Components/TextArea.jsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/src/Editor/Components/TextArea.jsx b/frontend/src/Editor/Components/TextArea.jsx index aae72dcbe8..40914f6e0a 100644 --- a/frontend/src/Editor/Components/TextArea.jsx +++ b/frontend/src/Editor/Components/TextArea.jsx @@ -12,13 +12,18 @@ export const TextArea = function TextArea({ useEffect(() => { setValue(properties.value); + setExposedVariable('value', properties.value); + + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [properties.value]); + + useEffect(() => { const exposedVariables = { - value: properties.value, setText: async function (text) { setValue(text); setExposedVariable('value', text); }, - clear: async function (text) { + clear: async function () { setValue(''); setExposedVariable('value', ''); }, @@ -26,7 +31,7 @@ export const TextArea = function TextArea({ setExposedVariables(exposedVariables); // eslint-disable-next-line react-hooks/exhaustive-deps - }, [properties.value, setValue]); + }, [setValue]); return (