Skip to content

Commit

Permalink
Fixed an issue miss loading-indicator.
Browse files Browse the repository at this point in the history
  • Loading branch information
Imiss-U1025 committed Nov 23, 2024
1 parent ab549e4 commit 4871649
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 5 deletions.
2 changes: 2 additions & 0 deletions client/packages/lowcoder/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
display: flex;
pointer-events: none;
flex-direction: column;
top: 0;
z-index: 10000;
}
#loading svg {
animation: breath 1s linear infinite;
Expand Down
3 changes: 2 additions & 1 deletion client/packages/lowcoder/src/comps/comps/rootComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { ExternalEditorContext } from "util/context/ExternalEditorContext";
import { useUserViewMode } from "util/hooks";
import React from "react";
import { isEqual } from "lodash";

import {LoadingBarHideTrigger} from "@lowcoder-ee/util/hideLoading";
const EditorView = lazy(
() => import("pages/editor/editorView"),
);
Expand Down Expand Up @@ -138,6 +138,7 @@ const RootView = React.memo((props: RootViewProps) => {
<div key={key}>{comp.children.queries.children[key].getView()}</div>
))}
<Suspense fallback={!readOnly || isUserViewMode ? SuspenseFallback : null}>
<LoadingBarHideTrigger />
<EditorView uiComp={comp.children.ui} preloadComp={comp.children.preload} />
</Suspense>
</EditorContext.Provider>
Expand Down
4 changes: 2 additions & 2 deletions client/packages/lowcoder/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (!window.ResizeObserver) {
window.ResizeObserver = ResizeObserver;
}

function hideLoading() {
export function hideLoading() {
// hide loading
const node = document.getElementById("loading");
if (node) {
Expand All @@ -42,7 +42,7 @@ debug(`REACT_APP_LOG_LEVEL:, ${REACT_APP_LOG_LEVEL}`);

try {
bootstrap();
hideLoading();
// hideLoading();
} catch (e) {
log.error(e);
}
3 changes: 2 additions & 1 deletion client/packages/lowcoder/src/pages/ApplicationV2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import AppEditor from "../editor/AppEditor";
import { fetchDeploymentIdAction } from "@lowcoder-ee/redux/reduxActions/configActions";
import { getDeploymentId } from "@lowcoder-ee/redux/selectors/configSelectors";
import { SimpleSubscriptionContextProvider } from '@lowcoder-ee/util/context/SimpleSubscriptionContext';

import {LoadingBarHideTrigger} from "@lowcoder-ee/util/hideLoading";
const TabLabel = styled.div`
font-weight: 500;
`;
Expand Down Expand Up @@ -222,6 +222,7 @@ export default function ApplicationHome() {

return (
<DivStyled>
<LoadingBarHideTrigger />
<SimpleSubscriptionContextProvider>
<Layout
sections={[
Expand Down
3 changes: 2 additions & 1 deletion client/packages/lowcoder/src/pages/userAuth/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { fetchConfigAction } from "redux/reduxActions/configActions";
import { fetchUserAction } from "redux/reduxActions/userActions";
import LoginAdmin from "./loginAdmin";
import _ from "lodash";

import {LoadingBarHideTrigger} from "@lowcoder-ee/util/hideLoading";
export default function UserAuth() {
const dispatch = useDispatch();
const location = useLocation<AuthLocationState>();
Expand Down Expand Up @@ -50,6 +50,7 @@ export default function UserAuth() {
fetchUserAfterAuthSuccess,
}}
>
<LoadingBarHideTrigger />
<Switch location={location}>
<Redirect exact from={USER_AUTH_URL} to={AUTH_LOGIN_URL} />
<Route exact path={ADMIN_AUTH_URL} component={LoginAdmin} />
Expand Down
10 changes: 10 additions & 0 deletions client/packages/lowcoder/src/util/hideLoading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {useEffect} from "react";
import {hideLoading} from "@lowcoder-ee/index";

export const LoadingBarHideTrigger = function(props: any) {
useEffect(() => {
setTimeout(() => hideLoading(), 300);
}, []);

return <></>
};

0 comments on commit 4871649

Please sign in to comment.