File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
client/packages/lowcoder/src/comps/comps/lazyLoadComp Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import styled from "styled-components";
1111import { RemoteCompInfo } from "types/remoteComp" ;
1212import { withErrorBoundary } from "comps/generators/withErrorBoundary" ;
1313import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext" ;
14+ import React from "react" ;
1415
1516const ViewError = styled . div `
1617 display: flex;
@@ -50,7 +51,7 @@ interface LazyCompViewProps {
5051 errorElement ?: ( error : any ) => React . ReactNode ;
5152}
5253
53- function LazyCompView ( props : React . PropsWithChildren < LazyCompViewProps > ) {
54+ const LazyCompView = React . memo ( ( props : React . PropsWithChildren < LazyCompViewProps > ) => {
5455 const { loadComp, loadingElement, errorElement } = props ;
5556 const [ error , setError ] = useState < any > ( "" ) ;
5657 const currentTheme = useContext ( ThemeContext ) ?. theme ;
@@ -83,7 +84,7 @@ function LazyCompView(props: React.PropsWithChildren<LazyCompViewProps>) {
8384 return (
8485 < WhiteLoading />
8586 ) ;
86- }
87+ } ) ;
8788
8889export type LazyloadCompLoader < T = RemoteCompInfo > = ( ) => Promise < CompConstructor | null > ;
8990
You can’t perform that action at this time.
0 commit comments