Conversation
Convert all protoFleet and protoOS routes to React.lazy with a Suspense boundary in each App component, and tighten manualChunks in vite.config to only force-bucket entry-bundle deps so lazy-route deps land in their own chunks. Cuts initial JS by ~43% on protoFleet (567 → 320 KB gz) and ~33% on protoOS (407 → 273 KB gz). Refs #46 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
🔐 Codex Security Review
Review SummaryOverall Risk: NONE FindingsNo security, correctness, or reliability findings identified in the reviewed diff. Notes
Generated by Codex Security Review | |
There was a problem hiding this comment.
Pull request overview
This PR reduces the initial JavaScript payload for both protoFleet and protoOS by code-splitting route components with React.lazy + Suspense, and by tightening Vite’s manualChunks so only true entry-bundle dependencies are force-bucketed.
Changes:
- Converted protoFleet and protoOS route components to
React.lazyso each route loads as its own chunk. - Added
Suspenseboundaries in both apps’Appcomponents with a shared loading spinner fallback. - Updated
vite.config.tschunking rules to avoid preloading non-entry dependencies (e.g., route-only libraries).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| client/vite.config.ts | Restricts forced vendor chunking to core entry deps (React, router, buf/connect), allowing route deps to stay in lazy/shared chunks. |
| client/src/protoOS/router.tsx | Lazifies protoOS route components so single-miner routes don’t inflate protoFleet’s entry bundle. |
| client/src/protoOS/components/App/App.tsx | Adds a Suspense boundary to render a loading fallback while lazy route chunks load. |
| client/src/protoFleet/router.tsx | Lazifies protoFleet route components and keeps route tree structure the same. |
| client/src/protoFleet/components/App/App.tsx | Adds a Suspense boundary to render a loading fallback while lazy route chunks load. |
Summary
protoFleetandprotoOSroutes toReact.lazyand add aSuspenseboundary in eachAppcomponent, so each route ships in its own chunk.manualChunksinvite.config.tsto only force-bucket entry-bundle deps (react,react-router,@bufbuild/@connectrpc); lazy-route deps likerecharts,motion, anddnd-kitnow land in route or shared chunks instead of being preloaded with the entry.Refs #46
Test plan
npm run buildproduces both bundles without errors/,/miners,/groups,/racks,/activity,/settings/*,/auth,/welcome,/fleet-down/miners/:id/{hashrate,efficiency,power-usage,temperature,logs,diagnostics,settings/*}🤖 Generated with Claude Code