Skip to content

Commit 5a43440

Browse files
memoize cacheView and cachePropertyView
1 parent fe9a35c commit 5a43440

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const TmpComp = withTypeAndChildren<
6262
childrenMap
6363
);
6464

65-
function CachedView(props: { comp: Comp; name: string }) {
65+
const CachedView = React.memo((props: { comp: Comp; name: string }) => {
6666
return React.useMemo(
6767
() => (
6868
<Profiler id={props.name} onRender={profilerCallback}>
@@ -73,13 +73,13 @@ function CachedView(props: { comp: Comp; name: string }) {
7373
),
7474
[props.comp, props.name]
7575
);
76-
}
76+
})
7777

78-
function CachedPropertyView(props: {
78+
const CachedPropertyView = React.memo((props: {
7979
comp: Comp;
8080
name: string;
8181
withParamsContext: WithParamsContext;
82-
}) {
82+
}) => {
8383
const prevHints = useContext(CompExposingContext);
8484
const { withParamsContext } = props;
8585
const hints = useMemo(
@@ -109,7 +109,7 @@ function CachedPropertyView(props: {
109109
</>
110110
);
111111
}, [props.comp, props.name, hints, searchText, setSearchText]);
112-
}
112+
});
113113

114114
export class GridItemComp extends TmpComp {
115115
private readonly withParamsContext: WithParamsContext = { params: {} };

0 commit comments

Comments
 (0)