1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-10 17:53:36 +02:00

lazy demo

This commit is contained in:
Tymoteusz Czech 2023-06-05 13:38:48 +02:00
parent be7d22dec1
commit a695869aa0
No known key found for this signature in database
GPG Key ID: 133555230D88D75F
2 changed files with 18 additions and 3 deletions

View File

@ -0,0 +1,15 @@
import { FC, Suspense, lazy } from 'react';
const LazyDemoComponent = lazy(() =>
import('./Demo').then(module => ({
default: module.Demo,
}))
);
export const LazyDemo: FC = ({ children }) => (
<Suspense fallback={<>{children}</>}>
<LazyDemoComponent>
<>{children}</>
</LazyDemoComponent>
</Suspense>
);

View File

@ -14,7 +14,7 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/Condit
import { useChangeRequestsEnabled } from 'hooks/useChangeRequestsEnabled';
import { DraftBanner } from './DraftBanner/DraftBanner';
import { ThemeMode } from 'component/common/ThemeMode/ThemeMode';
import { Demo } from 'component/demo/Demo';
import { LazyDemo } from 'component/demo/LazyDemo';
interface IMainLayoutProps {
children: ReactNode;
@ -85,7 +85,7 @@ export const MainLayout = forwardRef<HTMLDivElement, IMainLayoutProps>(
return (
<>
<SkipNavLink />
<Demo>
<LazyDemo>
<>
<Header />
<SkipNavTarget />
@ -128,7 +128,7 @@ export const MainLayout = forwardRef<HTMLDivElement, IMainLayoutProps>(
<Footer />
</MainLayoutContainer>
</>
</Demo>
</LazyDemo>
</>
);
}