You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by do...@apache.org on 2023/03/19 09:33:12 UTC
[inlong] 01/06: [INLONG-7630][Dashboard] The page flickers when the route is switched (#7631)
This is an automated email from the ASF dual-hosted git repository.
dockerzhang pushed a commit to branch branch-1.6
in repository https://gitbox.apache.org/repos/asf/inlong.git
commit 3281f39c30a42518cacb02b31fb98b80f55bb151
Author: Daniel <le...@apache.org>
AuthorDate: Fri Mar 17 18:58:45 2023 +0800
[INLONG-7630][Dashboard] The page flickers when the route is switched (#7631)
---
inlong-dashboard/src/App.tsx | 35 +++++++++++++++++++++--------------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/inlong-dashboard/src/App.tsx b/inlong-dashboard/src/App.tsx
index 95cfc5840..9c3927194 100644
--- a/inlong-dashboard/src/App.tsx
+++ b/inlong-dashboard/src/App.tsx
@@ -97,7 +97,7 @@ const App = () => {
}, [history, location, setCurrentMenu]);
return (
- <Suspense fallback={<AppLoading />}>
+ <>
<Switch>
{useLogin && (
<Route
@@ -105,25 +105,32 @@ const App = () => {
path="/login"
render={() => {
const LazyLogin = lazy(() => import('@/pages/Login'));
- return <LazyLogin />;
+ return (
+ <Suspense fallback={<AppLoading />}>
+ <LazyLogin />
+ </Suspense>
+ );
}}
/>
)}
+
<AppLayout>
- <Switch>
- {Object.keys(redirectRoutes).map(path => (
- <Route
- exact
- key={path}
- path={path}
- render={() => <Redirect to={redirectRoutes[path]} />}
- />
- ))}
- {renderRoutes(routes)}
- </Switch>
+ <Suspense fallback={<AppLoading />}>
+ <Switch>
+ {Object.keys(redirectRoutes).map(path => (
+ <Route
+ exact
+ key={path}
+ path={path}
+ render={() => <Redirect to={redirectRoutes[path]} />}
+ />
+ ))}
+ {renderRoutes(routes)}
+ </Switch>
+ </Suspense>
</AppLayout>
</Switch>
- </Suspense>
+ </>
);
};