diff --git a/app/client/src/pages/Editor/PropertyPane/index.tsx b/app/client/src/pages/Editor/PropertyPane/index.tsx index 58a91673af..16b030e313 100644 --- a/app/client/src/pages/Editor/PropertyPane/index.tsx +++ b/app/client/src/pages/Editor/PropertyPane/index.tsx @@ -1,4 +1,4 @@ -import React, { useRef } from "react"; +import React, { useRef, useEffect, useState } from "react"; import styled from "styled-components"; import { useSelector } from "react-redux"; import { PanelStack, Classes } from "@blueprintjs/core"; @@ -6,6 +6,7 @@ import { PanelStack, Classes } from "@blueprintjs/core"; import { get } from "lodash"; import { getSelectedWidgets } from "selectors/ui"; import PropertyPaneView from "./PropertyPaneView"; +import { retryPromise } from "utils/AppsmithUtils"; const StyledPanelStack = styled(PanelStack)` height: 100%; @@ -28,8 +29,29 @@ function PropertyPane() { const selectedWidgets = useSelector(getSelectedWidgets); const panelWrapperRef = useRef(null); + // Track registration state + const [controlsRegistered, setControlsRegistered] = useState(false); + + useEffect(() => { + const loadPropertyControlBuilders = async () => { + const module = await retryPromise( + async () => + import( + /* webpackChunkName: "PropertyControlRegistry" */ "utils/PropertyControlRegistry" + ), + ); + + module.default.registerPropertyControlBuilders(); + + setControlsRegistered(true); + }; + + loadPropertyControlBuilders(); + }, []); + // TODO: add analytics code if ( + !controlsRegistered || selectedWidgets.length === 0 || get(selectedWidgets, "0.disablePropertyPane") ) { diff --git a/app/client/src/utils/editor/EditorUtils.ts b/app/client/src/utils/editor/EditorUtils.ts index 52ce8faa1a..138da365f2 100644 --- a/app/client/src/utils/editor/EditorUtils.ts +++ b/app/client/src/utils/editor/EditorUtils.ts @@ -1,4 +1,3 @@ -import PropertyControlRegistry from "../PropertyControlRegistry"; // import WidgetFactory from "WidgetProvider/factory"; // import Widgets from "widgets"; import { registerWidgets } from "WidgetProvider/factory/registrationHelper"; @@ -11,7 +10,6 @@ export const registerEditorWidgets = () => { export const editorInitializer = async () => { registerEditorWidgets(); - PropertyControlRegistry.registerPropertyControlBuilders(); // TODO: do this only for anvil. registerLayoutComponents(); };