Skip to content

perf(routes): implement lazy loading for page components - #1044

Open
OP-Prajwal wants to merge 3 commits into
sugarlabs:mainfrom
OP-Prajwal:patch-route-code-splitting
Open

perf(routes): implement lazy loading for page components#1044
OP-Prajwal wants to merge 3 commits into
sugarlabs:mainfrom
OP-Prajwal:patch-route-code-splitting

Conversation

@OP-Prajwal

Copy link
Copy Markdown

This PR focuses on improving the application's initial load time by implementing route-level code splitting.

Changes Made:

  • Refactored src/routes.tsx to dynamically import page components using React.lazy().
  • Added a reusable <PageLoader /> fallback component to display during chunk fetching.

This significantly reduces the size of the initial JavaScript payload (preventing all 26 pages from being downloaded on the first visit). I have tested the build locally and verified that Vite successfully splits the components into distinct chunks.

(Note: If this approach looks good to the team, I plan to open a follow-up PR to add loading="lazy" to the site's images for further performance optimization.)

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown

🎉 All Checks Passed!

Great work! Every automated check succeeded on this pull request.

Check Status
Build ✅ Passed
TypeScript linting ✅ Passed
Markdown linting ✅ Passed
Code formatting ✅ Passed

This pull request is ready for maintainer review. 🚀


View the full check logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant