Skip to content

perf: lazy-loads route components with ErrorBoundary and chunk prefetch#40

Merged
wgordon17 merged 4 commits intogordon-code:mainfrom
wgordon17:perf/lazy-route-loading
Apr 1, 2026
Merged

perf: lazy-loads route components with ErrorBoundary and chunk prefetch#40
wgordon17 merged 4 commits intogordon-code:mainfrom
wgordon17:perf/lazy-route-loading

Conversation

@wgordon17
Copy link
Copy Markdown
Member

Summary

  • Lazy-loads DashboardPage, OnboardingWizard, and SettingsPage via SolidJS lazy(), splitting the 586 kB monolithic bundle into 7 chunks (largest 258 kB)
  • Adds ErrorBoundary with user-friendly fallback for chunk load failures (e.g. stale hashes after redeploy), with console.error logging for observability
  • Prefetches the dashboard chunk in parallel with token validation (authenticated reloads) and speculatively during idle time on the login page (first-visit flow)

- adds Suspense boundary wrapping Router for lazy chunk loading states
- adds /api/csp-report worker endpoint that scrubs OAuth params before
  forwarding CSP violation reports to Sentry (replaces direct report-uri)
- adds Reporting-Endpoints header enabling modern report-to directive
- removes unnecessary blob: from CSP img-src
- extracts ErrorBoundary fallback to named handleRouteError function
- adds .catch() with console.warn to both prefetch paths
- adds [app] to Sentry allowed console breadcrumb prefixes
- extracts getOrCacheDsn helper to deduplicate DSN cache logic
- adds parseSentryDsn publicKey validation
- caps CSP report batch fan-out to 20 to prevent amplification
- scrubs referrer field in CSP reports (OAuth param leak vector)
- adds 18 tests covering CSP report endpoint, ErrorBoundary for all
  lazy routes, prefetch scheduling, and sentry prefix
@wgordon17 wgordon17 merged commit 550293f into gordon-code:main Apr 1, 2026
1 check passed
@wgordon17 wgordon17 deleted the perf/lazy-route-loading branch April 8, 2026 17:00
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