Skip to content

Commit 206200f

Browse files
committed
refactor: import HomeNavBoxes directly for improved performance
- Replaced lazy loading of HomeNavBoxes with direct import to enhance loading speed for critical content. - Removed unnecessary Suspense component, simplifying the rendering logic.
1 parent 551be95 commit 206200f

1 file changed

Lines changed: 4 additions & 28 deletions

File tree

src/pages/index.js

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { Suspense } from 'react';
1+
import React from 'react';
22
import clsx from 'clsx';
33
import Layout from '@theme/Layout';
44
import Link from '@docusaurus/Link';
@@ -9,10 +9,8 @@ import { Redirect } from '@docusaurus/router';
99
import ErrorBoundary from '../components/ErrorBoundary';
1010
import StructuredData from '../structured-data/schema';
1111

12-
// Lazy load non-critical components
13-
const HomeNavBoxes = React.lazy(
14-
() => import('../components/homepage/homeNavBoxes')
15-
);
12+
// Import HomeNavBoxes directly since it's above-the-fold critical content
13+
import HomeNavBoxes from '../components/homepage/homeNavBoxes';
1614

1715
function HomepageHeader() {
1816
return (
@@ -87,15 +85,11 @@ export default function Home() {
8785
<style>{`
8886
.heroBanner_KU2A{padding:2rem 0 0 0;text-align:center;position:relative;overflow:hidden}
8987
.hero__title{font-size:62px;font-weight:700;line-height:115%;margin-bottom:0;color:var(--ifm-font-color-base);font-family:'Montserrat',sans-serif;margin-top:2rem}
90-
main section{min-height:2100px;padding:2rem 0}
9188
.theme-layout-footer{min-height:350px}
9289
.footer__links{min-height:200px}
9390
.footer__col{min-height:180px}
9491
.footer__bottom{min-height:50px}
95-
@media screen and (max-width:1680px){main section{min-height:1900px}}
96-
@media screen and (max-width:1180px){main section{min-height:3200px}}
9792
@media screen and (max-width:966px){.heroBanner_KU2A{padding:2rem}.hero__title{font-size:48px}.theme-layout-footer{min-height:600px}.footer__links{min-height:450px}.footer__col{min-height:100px}}
98-
@media screen and (max-width:768px){main section{min-height:4800px}}
9993
`}</style>
10094

10195
{/* Prefetch important pages */}
@@ -109,25 +103,7 @@ export default function Home() {
109103
<HomepageHeader />
110104
<main>
111105
<ErrorBoundary>
112-
<Suspense
113-
fallback={
114-
<div
115-
style={{
116-
minHeight: '2100px',
117-
display: 'flex',
118-
alignItems: 'center',
119-
justifyContent: 'center',
120-
fontSize: '14px',
121-
color: 'var(--ifm-color-emphasis-600)',
122-
padding: '2rem 0',
123-
}}
124-
>
125-
Loading navigation...
126-
</div>
127-
}
128-
>
129-
<HomeNavBoxes />
130-
</Suspense>
106+
<HomeNavBoxes />
131107
</ErrorBoundary>
132108
</main>
133109
</Layout>

0 commit comments

Comments
 (0)