Skip to content

perf(web): load each page on demand, React in its own chunk - #258

Merged
jplanckeel merged 1 commit into
mainfrom
perf/web-code-splitting
Oct 30, 2026
Merged

jplanckeel merged 1 commit into
mainfrom
perf/web-code-splitting

Conversation

@jplanckeel

Copy link
Copy Markdown
Contributor

What

The SPA was a single 1.7 MB bundle (454 KB gzip): every page, recharts, reactflow and the create forms were downloaded before the dashboard could render.

  • React.lazy for every route and for the create panels (CreatePanelHost). Layout wraps the Outlet in Suspense, so the sidebar and header stay while a page chunk loads.
  • vendor-react chunk (react, react-dom, scheduler, react-router, TanStack Query) through rolldown codeSplitting.groups: it changes far less often than the app, so it stays in the browser cache across deploys. With perf: paginate ListEvents, gzip the HTTP responses, cache the assets #257 the hashed assets are cached immutable.
Chunk Size gzip
before: index.js (everything) 1 707 KB 454 KB
vendor-react 293 KB 92 KB
index (layout, shared) 232 KB 80 KB
Dashboard 23 KB 6 KB
Insights (with recharts) 420 KB 107 KB
reactflow (CatalogDependencies, CatalogDetail) 137 KB 43 KB

Dashboard first load: about 550 KB instead of 1.7 MB.

Checks

  • Playwright against serv + web/dist: the 21 routes reached by client-side navigation render, the 5 create panels (event, lock, drift, RPA, service) open, no JS error.
  • lint (0 issue), build:check, build:static, npm test (27): OK.

Follow-up ideas

  • The dashboard still pulls EventDetailsModal and the date-time picker (about 90 KB) on first load; they could load when the modal opens.

🤖 Generated with Claude Code

- Routes and create panels are lazy-loaded; Layout keeps the sidebar and
  shows a spinner while a page chunk downloads
- React, the router and TanStack Query go to a vendor-react chunk that
  stays cached across deploys
- The dashboard first load drops from 1.7 MB (454 KB gzip) to about
  550 KB; recharts and reactflow only load with the pages that use them

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jplanckeel
jplanckeel merged commit ec26ef5 into main Oct 30, 2026
3 checks passed
@jplanckeel
jplanckeel deleted the perf/web-code-splitting branch October 30, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant