Skip to content

Commit 4dbe9d4

Browse files
hide loading indicator for comps based on app setting
1 parent b668155 commit 4dbe9d4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ import { GreyTextColor } from "constants/style";
55
import log from "loglevel";
66
import { Comp, CompAction, CompConstructor, CompParams, customAction, isCustomAction } from "lowcoder-core";
77
import { WhiteLoading } from "lowcoder-design";
8-
import { useState } from "react";
8+
import { useContext, useState } from "react";
99
import { useMount } from "react-use";
1010
import styled from "styled-components";
1111
import { RemoteCompInfo, RemoteCompLoader } from "types/remoteComp";
1212
import { withErrorBoundary } from "comps/generators/withErrorBoundary";
13+
import { EditorContext } from "@lowcoder-ee/comps/editorState";
1314

1415
const ViewError = styled.div`
1516
display: flex;
@@ -52,6 +53,8 @@ interface LazyCompViewProps {
5253
function LazyCompView(props: React.PropsWithChildren<LazyCompViewProps>) {
5354
const { loadComp, loadingElement, errorElement } = props;
5455
const [error, setError] = useState<any>("");
56+
const editorState = useContext(EditorContext);
57+
const showComponentLoadingIndicators = editorState?.getAppSettings().showComponentLoadingIndicators;
5558

5659
useMount(() => {
5760
setError("");
@@ -71,14 +74,14 @@ function LazyCompView(props: React.PropsWithChildren<LazyCompViewProps>) {
7174
);
7275
}
7376

77+
if (!showComponentLoadingIndicators) return<></>;
78+
7479
if (loadingElement) {
7580
return <ViewLoadingWrapper>{loadingElement()}</ViewLoadingWrapper>;
7681
}
7782

7883
return (
79-
<ViewLoadingWrapper>
80-
<WhiteLoading />
81-
</ViewLoadingWrapper>
84+
<WhiteLoading />
8285
);
8386
}
8487

0 commit comments

Comments
 (0)