fix/event-fire-editor-ready (#10489)

* fix/event-fire-editor-ready

* Resolved comments
This commit is contained in:
Shaurya Sharma 2024-07-31 12:17:36 +05:30 committed by GitHub
parent a2852c2ed7
commit df7f774b12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 (
<OverlayTrigger
placement={inCanvas ? 'auto' : 'top'}