Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2304cd9

Browse files
memoize lazyloadView
1 parent5a43440 commit2304cd9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

‎client/packages/lowcoder/src/comps/comps/lazyLoadComp/lazyLoadComp.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import styled from "styled-components";
1111
import{RemoteCompInfo}from"types/remoteComp";
1212
import{withErrorBoundary}from"comps/generators/withErrorBoundary";
1313
import{ThemeContext}from"@lowcoder-ee/comps/utils/themeContext";
14+
importReactfrom"react";
1415

1516
constViewError=styled.div`
1617
display: flex;
@@ -50,7 +51,7 @@ interface LazyCompViewProps {
5051
errorElement?:(error:any)=>React.ReactNode;
5152
}
5253

53-
functionLazyCompView(props:React.PropsWithChildren<LazyCompViewProps>){
54+
constLazyCompView=React.memo((props:React.PropsWithChildren<LazyCompViewProps>)=>{
5455
const{ loadComp, loadingElement, errorElement}=props;
5556
const[error,setError]=useState<any>("");
5657
constcurrentTheme=useContext(ThemeContext)?.theme;
@@ -83,7 +84,7 @@ function LazyCompView(props: React.PropsWithChildren<LazyCompViewProps>) {
8384
return(
8485
<WhiteLoading/>
8586
);
86-
}
87+
});
8788

8889
exporttypeLazyloadCompLoader<T=RemoteCompInfo>=()=>Promise<CompConstructor|null>;
8990

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp