Skip to content

Commit 1580a02

Browse files
added switch to load module in DOM when hide
1 parent fc4f9a8 commit 1580a02

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ const childrenMap = {
8585
events: eventHandlerControl(),
8686
autoHeight: AutoHeightControl,
8787
scrollbars: withDefault(BoolControl, false),
88+
loadInDomWhenHide: withDefault(BoolControl, true),
8889
};
8990

9091
type DataType = ToDataType<ToInstanceType<typeof childrenMap>>;
@@ -127,6 +128,9 @@ class ModuleTmpComp extends ModuleCompBase {
127128
label: trans("prop.scrollbar"),
128129
})}
129130
{hiddenPropertyView(this.children)}
131+
{this.children.hidden.getView() && this.children.loadInDomWhenHide.propertyView({
132+
label: "Load module in DOM when hidden",
133+
})}
130134
</Section>
131135
</>
132136
);
@@ -525,6 +529,9 @@ const ModuleCompWithView = withViewFn(ModuleTmpComp, (comp) => {
525529
if (error) {
526530
return <Placeholder>{error}</Placeholder>;
527531
}
532+
if (comp.children.hidden.getView() && !comp.children.loadInDomWhenHide.getView()) {
533+
return null;
534+
}
528535

529536
let content: ReactNode = appId ? <ModuleLoading /> : <Placeholder />;
530537
if (comp.moduleRootComp && comp.isReady) {

0 commit comments

Comments
 (0)