AOSSIE-Org / AOSSIE-Org/EduAid

[Enhancement]: Optimize initial load time via route-based code splitting in App.js

オープン
#475 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement
主要言語
JavaScript
スター
171
フォーク
425
PR マージ指標
30日以内にマージされた PR はありません

説明

### Feature and its Use Cases

### Overview
During a performance review of the web application's initial load sequence, I noticed that all page components (such as `Home`, `Output`, `Previous`, etc.) are imported synchronously at the top level of `App.js`.

### The Bottleneck
Because these components—and their heavy underlying dependencies, such as `pdf-lib`—are bundled together, the browser is forced to download the entire application's JavaScript payload before it can render the initial landing page. This inflates the initial `bundle.js` size and negatively impacts First Contentful Paint (FCP). As the application scales with new features, this bundle will only continue to grow.

### Proposed Architecture Change
Implement route-based code-splitting to load pages dynamically only when the user navigates to them:
1. Convert static page imports to dynamic `React.lazy()` imports.
2. Wrap the `Routes` block in a `` boundary.
3. Provide a lightweight, non-blocking fallback UI (like an `animate-spin` loader matching the EduAid brand colors) to maintain UX during chunk fetching.

*Note: I have already tested this architecture locally and captured the Chrome DevTools Network metrics showing a significant reduction in the initial payload. I will link a PR shortly with the implementation and visual proof.*

### Additional Context

_No response_

### Code of Conduct

- [x] I have joined the [Discord server](https://discord.gg/hjUhu33uAn) and will post updates there
- [x] I have searched existing issues to avoid duplicates

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。