From df7f774b121f932947fd05a1a19012fb4962ca47 Mon Sep 17 00:00:00 2001 From: Shaurya Sharma <79473274+shaurya-sharma064@users.noreply.github.com> Date: Wed, 31 Jul 2024 12:17:36 +0530 Subject: [PATCH] fix/event-fire-editor-ready (#10489) * fix/event-fire-editor-ready * Resolved comments --- frontend/src/Editor/BoxUI.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/Editor/BoxUI.jsx b/frontend/src/Editor/BoxUI.jsx index 61f870a9db..e6dd2dda75 100644 --- a/frontend/src/Editor/BoxUI.jsx +++ b/frontend/src/Editor/BoxUI.jsx @@ -59,6 +59,7 @@ const BoxUI = (props) => { const { variablesExposedForPreview, exposeToCodeHinter } = useContext(EditorContext) || {}; const currentState = useCurrentState(); + const isEditorReady = useCurrentStateStore((state) => state.isEditorReady); const validate = (value) => validateWidget({ @@ -78,6 +79,7 @@ const BoxUI = (props) => { let exposedVariables = !_.isEmpty(currentState?.components) ? currentState?.components[component.name] ?? {} : {}; const fireEvent = (eventName, options) => { + if (!isEditorReady) return; if (mode === 'edit' && eventName === 'onClick') { onComponentClick(id, component); } @@ -98,8 +100,6 @@ const BoxUI = (props) => { // eslint-disable-next-line react-hooks/exhaustive-deps }, []); - const isEditorReady = useCurrentStateStore((state) => state.isEditorReady); - return (