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";
11
11
import { RemoteCompInfo } from "types/remoteComp" ;
12
12
import { withErrorBoundary } from "comps/generators/withErrorBoundary" ;
13
13
import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext" ;
14
+ import React from "react" ;
14
15
15
16
const ViewError = styled . div `
16
17
display: flex;
@@ -50,7 +51,7 @@ interface LazyCompViewProps {
50
51
errorElement ?: ( error : any ) => React . ReactNode ;
51
52
}
52
53
53
- function LazyCompView ( props : React . PropsWithChildren < LazyCompViewProps > ) {
54
+ const LazyCompView = React . memo ( ( props : React . PropsWithChildren < LazyCompViewProps > ) => {
54
55
const { loadComp, loadingElement, errorElement } = props ;
55
56
const [ error , setError ] = useState < any > ( "" ) ;
56
57
const currentTheme = useContext ( ThemeContext ) ?. theme ;
@@ -83,7 +84,7 @@ function LazyCompView(props: React.PropsWithChildren<LazyCompViewProps>) {
83
84
return (
84
85
< WhiteLoading />
85
86
) ;
86
- }
87
+ } ) ;
87
88
88
89
export type LazyloadCompLoader < T = RemoteCompInfo > = ( ) => Promise < CompConstructor | null > ;
89
90
You can’t perform that action at this time.
0 commit comments