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 (