Skip to content

perf: lazy-load routes and prefetch feed#560

Merged
paulvanbrenk merged 1 commit intomainfrom
perf/lazy-routes-and-feed-preload
Mar 18, 2026
Merged

perf: lazy-load routes and prefetch feed#560
paulvanbrenk merged 1 commit intomainfrom
perf/lazy-routes-and-feed-preload

Conversation

@paulvanbrenk
Copy link
Collaborator

Summary

  • Split all page routes into route definition + lazy component files, so page code loads on demand
  • Add TanStack Router loader on the homepage to prefetch /api/feed via ensureQueryData — API fetch now runs in parallel with the lazy component download instead of waiting for React to mount
  • Main bundle: 551KB → 508KB (-8% / 14KB gzip saved)

Chunks split out

  • login.lazy (55KB) — Stytch login widget
  • watchlist.lazy (17KB)
  • HeroCard (13KB)
  • settings.lazy (9KB)
  • index.lazy (7KB) — homepage
  • Plus 8 more small route chunks

Test plan

  • Build: clean, 169 tests pass
  • All existing lazy routes (admin) still work

🤖 Generated with Claude Code

- Split all page routes into route definition + lazy component so page
  code is loaded on demand instead of bundled into the main chunk
- Add route loader to prefetch /api/feed via ensureQueryData so the API
  fetch runs in parallel with the lazy component download
- Main bundle: 551KB → 508KB (-8%), with page components now in
  separate chunks loaded on navigation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@paulvanbrenk paulvanbrenk enabled auto-merge March 18, 2026 21:39
@paulvanbrenk paulvanbrenk merged commit 90a5d52 into main Mar 18, 2026
4 checks passed
@paulvanbrenk paulvanbrenk deleted the perf/lazy-routes-and-feed-preload branch March 18, 2026 21:41
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