Skip to content

Commit 868858f

Browse files
authored
Merge pull request #792 from raheeliftikhar5/flickering-issue
Fixed flickering issue in app editor
2 parents f09c387 + aff6aa9 commit 868858f

File tree

4 files changed

+20
-13
lines changed

4 files changed

+20
-13
lines changed

client/packages/lowcoder/src/app.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,9 @@ class AppIndex extends React.Component<AppIndexProps, any> {
142142
/>
143143
)}
144144
<LazyRoute exact path={IMPORT_APP_FROM_TEMPLATE_URL} component={LazyAppFromTemplate} />
145-
<LazyRoute path={APP_EDITOR_URL} component={LazyAppEditor} />
145+
<LazyRoute fallback="layout" path={APP_EDITOR_URL} component={LazyAppEditor} />
146146
<LazyRoute
147+
fallback="layout"
147148
path={[
148149
ALL_APPLICATIONS_URL,
149150
DATASOURCE_CREATE_URL,

client/packages/lowcoder/src/components/LazyRoute.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { default as Skeleton } from "antd/es/skeleton";
22
import { ComponentType, lazy, Suspense, useRef } from "react";
33
import { Route, RouteProps } from "react-router";
44
import PageSkeleton from "./PageSkeleton";
5+
import EditorSkeletonView from "@lowcoder-ee/pages/editor/editorSkeletonView";
6+
import { ProductLoading } from "./ProductLoading";
57

68
interface IProps extends RouteProps {
79
/**
@@ -13,7 +15,7 @@ interface IProps extends RouteProps {
1315

1416
const fallbacks = {
1517
normal: <Skeleton style={{ padding: 32 }} />,
16-
layout: <PageSkeleton />,
18+
layout: <ProductLoading />,
1719
outAppLayout: <PageSkeleton logoWithName />,
1820
};
1921

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
} from "lowcoder-design";
3232
import RefTreeComp from "./refTreeComp";
3333
import { ExternalEditorContext } from "util/context/ExternalEditorContext";
34+
import { useUserViewMode } from "util/hooks";
3435

3536
const EditorView = lazy(
3637
() => import("pages/editor/editorView"),
@@ -60,6 +61,7 @@ function RootView(props: RootViewProps) {
6061
const [editorState, setEditorState] = useState<EditorState>();
6162
const [propertySectionState, setPropertySectionState] = useState<PropertySectionState>({});
6263
const { readOnly } = useContext(ExternalEditorContext);
64+
const isUserViewMode = useUserViewMode();
6365
const appThemeId = comp.children.settings.getView().themeId;
6466
const { orgCommonSettings } = getGlobalSettings();
6567
const themeList = orgCommonSettings?.themeList || [];
@@ -109,7 +111,7 @@ function RootView(props: RootViewProps) {
109111
};
110112
}, [editorState, propertySectionState]);
111113

112-
if (!editorState && readOnly) {
114+
if (!editorState && !isUserViewMode && readOnly) {
113115
return <ModuleLoading />;
114116
}
115117

@@ -127,7 +129,7 @@ function RootView(props: RootViewProps) {
127129
{Object.keys(comp.children.queries.children).map((key) => (
128130
<div key={key}>{comp.children.queries.children[key].getView()}</div>
129131
))}
130-
<Suspense fallback={!readOnly && SuspenseFallback}>
132+
<Suspense fallback={!readOnly || isUserViewMode ? SuspenseFallback : null}>
131133
<EditorView uiComp={comp.children.ui} preloadComp={comp.children.preload} />
132134
</Suspense>
133135
</EditorContext.Provider>

client/packages/lowcoder/src/pages/editor/editorView.tsx

+11-9
Original file line numberDiff line numberDiff line change
@@ -393,15 +393,17 @@ function EditorView(props: EditorViewProps) {
393393
<script key="clearbit-script" src="https://tag.clearbitscripts.com/v1/pk_931b51e405557300e6a7c470e8247d5f/tags.js" referrerPolicy="strict-origin-when-cross-origin" type="text/javascript"></script>
394394
]}
395395
</Helmet>
396-
{!hideBodyHeader && <PreviewHeader />}
397-
<EditorContainerWithViewMode>
398-
<ViewBody $hideBodyHeader={hideBodyHeader} $height={height}>
399-
{uiComp.getView()}
400-
</ViewBody>
401-
<div style={{ zIndex: Layers.hooksCompContainer }}>
402-
{hookCompViews}
403-
</div>
404-
</EditorContainerWithViewMode>
396+
<Suspense fallback={<EditorSkeletonView />}>
397+
{!hideBodyHeader && <PreviewHeader />}
398+
<EditorContainerWithViewMode>
399+
<ViewBody $hideBodyHeader={hideBodyHeader} $height={height}>
400+
{uiComp.getView()}
401+
</ViewBody>
402+
<div style={{ zIndex: Layers.hooksCompContainer }}>
403+
{hookCompViews}
404+
</div>
405+
</EditorContainerWithViewMode>
406+
</Suspense>
405407
</CustomShortcutWrapper>
406408
);
407409
}

0 commit comments

Comments
 (0)