fix: add Suspense to fix lazy load problem
This commit is contained in:
parent
82ff9a3013
commit
d093df928c
@ -9,7 +9,7 @@ import { Register } from './pages/Register';
|
|||||||
import { QueryClientProvider } from '@tanstack/react-query';
|
import { QueryClientProvider } from '@tanstack/react-query';
|
||||||
import { queryClient } from './api/cache';
|
import { queryClient } from './api/cache';
|
||||||
import { TokenLoginContainer } from './components/TokenLoginContainer';
|
import { TokenLoginContainer } from './components/TokenLoginContainer';
|
||||||
import React from 'react';
|
import React, { Suspense } from 'react';
|
||||||
import { trpc, trpcClient } from './api/trpc';
|
import { trpc, trpcClient } from './api/trpc';
|
||||||
import { MonitorPage } from './pages/Monitor';
|
import { MonitorPage } from './pages/Monitor';
|
||||||
import { WebsitePage } from './pages/Website';
|
import { WebsitePage } from './pages/Website';
|
||||||
@ -19,6 +19,7 @@ import { ConfigProvider, theme } from 'antd';
|
|||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { useSettingsStore } from './store/settings';
|
import { useSettingsStore } from './store/settings';
|
||||||
import { StatusPage } from './pages/Status';
|
import { StatusPage } from './pages/Status';
|
||||||
|
import { Loading } from './components/Loading';
|
||||||
|
|
||||||
export const AppRoutes: React.FC = React.memo(() => {
|
export const AppRoutes: React.FC = React.memo(() => {
|
||||||
const { info } = useUserStore();
|
const { info } = useUserStore();
|
||||||
@ -72,7 +73,9 @@ export const App: React.FC = React.memo(() => {
|
|||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<ConfigProvider theme={{ algorithm }}>
|
<ConfigProvider theme={{ algorithm }}>
|
||||||
<TokenLoginContainer>
|
<TokenLoginContainer>
|
||||||
|
<Suspense fallback={<Loading />}>
|
||||||
<AppRoutes />
|
<AppRoutes />
|
||||||
|
</Suspense>
|
||||||
</TokenLoginContainer>
|
</TokenLoginContainer>
|
||||||
</ConfigProvider>
|
</ConfigProvider>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
|
Loading…
Reference in New Issue
Block a user