Skip to content

Commit f50ad38

Browse files
memoize remoteCompView
1 parent 2304cd9 commit f50ad38

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

client/packages/lowcoder/src/comps/comps/remoteComp/remoteComp.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { loaders } from "./loaders";
1313
import { withErrorBoundary } from "comps/generators/withErrorBoundary";
1414
import { EditorContext } from "@lowcoder-ee/comps/editorState";
1515
import { CompContext } from "@lowcoder-ee/comps/utils/compContext";
16+
import React from "react";
1617

1718
const ViewError = styled.div`
1819
display: flex;
@@ -53,7 +54,7 @@ interface RemoteCompViewProps {
5354
errorElement?: (error: any) => React.ReactNode;
5455
}
5556

56-
function RemoteCompView(props: React.PropsWithChildren<RemoteCompViewProps>) {
57+
const RemoteCompView = React.memo((props: React.PropsWithChildren<RemoteCompViewProps>) => {
5758
const { loadComp, loadingElement, errorElement, isLowcoderComp } = props;
5859
const [error, setError] = useState<any>("");
5960
const editorState = useContext(EditorContext);
@@ -93,11 +94,9 @@ function RemoteCompView(props: React.PropsWithChildren<RemoteCompViewProps>) {
9394
}
9495

9596
return (
96-
<ViewLoadingWrapper>
97-
<WhiteLoading />
98-
</ViewLoadingWrapper>
97+
<WhiteLoading />
9998
);
100-
}
99+
});
101100

102101
export function remoteComp<T extends RemoteCompInfo = RemoteCompInfo>(
103102
remoteInfo?: T,

0 commit comments

Comments
 (0)