PromucFlow_constructor/app/client/src/pages/Editor/loader.tsx
2020-12-24 10:02:25 +05:30

28 lines
644 B
TypeScript

import React from "react";
import PageLoadingBar from "pages/common/PageLoadingBar";
import { retryPromise } from "utils/AppsmithUtils";
class EditorLoader extends React.PureComponent<any, { Page: any }> {
constructor(props: any) {
super(props);
this.state = {
Page: null,
};
}
componentDidMount() {
retryPromise(() => import(/* webpackChunkName: "editor" */ "./index")).then(
(module) => {
this.setState({ Page: module.default });
},
);
}
render() {
const { Page } = this.state;
return Page ? <Page {...this.props} /> : <PageLoadingBar />;
}
}
export default EditorLoader;