Title: perf: stop shipping error-boundary renderer chunks on every published page · Issue #567 · ycode/ycode · GitHub
Open Graph Title: perf: stop shipping error-boundary renderer chunks on every published page · Issue #567 · ycode/ycode
X Title: perf: stop shipping error-boundary renderer chunks on every published page · Issue #567 · ycode/ycode
Description: Summary Every published page still downloads and parses the error boundary's renderer chunks even though no error has occurred. Next injects the client-reference chunks of app/(site)/error.tsx into the initial HTML as errorScripts ( Open Graph Description: Summary Every published page still downloads and parses the error boundary's renderer chunks even though no error has occurred. Next injects the client-reference chunks of app/(site)/error.tsx into...
X Description: Summary Every published page still downloads and parses the error boundary's renderer chunks even though no error has occurred. Next injects the client-reference chunks of app/(site)/error.tsx ...
Opengraph URL: https://github.com/ycode/ycode/issues/567
X: @github
Domain: github.com
Links:
Viewport: width=device-width
Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"perf: stop shipping error-boundary renderer chunks on every published page","articleBody":"## Summary\n\nEvery published page still downloads and parses the error boundary's renderer chunks even though no error has occurred. Next injects the client-reference chunks of `app/(site)/error.tsx` into the initial HTML as `errorScripts` (`\u003cscript async>`), and one of those chunks is a module-for-module copy of a chunk the page renderer already loads. Follow-up to #548 / #558, found while measuring #551 after release (v1.30.19).\n\n## Evidence (client website homepage, production build)\n\nRSC flight payload, client references:\n\n| ref | source | chunks |\n|---|---|---|\n| `error.tsx` boundary | 6 chunks: `b7dab45d`, `1caf38dc`, `196ccc24`, `5df3feb8`, **`8be92b95`**, `9796c767` |\n| `LayerRendererPublic` / page | 10 chunks incl. `196ccc24`, `5df3feb8`, `9796c767`, **`c5e00107`** |\n\n- `8be92b95` (188 KB raw / 54 KB br) and `c5e00107` (188 KB raw / 53 KB br) contain the same 23 modules; 21 are byte-identical once Turbopack module IDs are masked. Both hold the rich-text / inline-variable code (`ycode-inline-variable`, `dynamicVariable`, `richText`).\n- `1caf38dc` (25 KB raw / 10 KB br) is error-boundary-only and contains `YcodeBadge` plus swiper references.\n- All six are emitted as `\u003cscript async>` in the SSR HTML via `errorScripts`, so they load on first view, not on error.\n- Net cost per page view: **~64 KB compressed, ~213 KB parsed/compiled**, on the mobile critical path before first paint (Lantern counts them against LCP).\n- The pre-release build had the same pair (2 × 52 KB br), so #558 removed the static `LayerRendererPublic` import from the boundary but the `next/dynamic` graph still resolves into a separate copy of the shared modules.\n\n## Likely cause\n\n`ErrorPageContent` is loaded with `next/dynamic` from `error.tsx`, but the modules it shares with the page (`lib/variable-utils`, rich-text helpers, `layer-utils`) are chunked into the error boundary's own group rather than the shared group the renderer uses. Turbopack does not dedupe across the two client-reference entry points, and Next always ships an error boundary's chunks with the page so the fallback can render offline.\n\n## Proposed fix\n\n1. Make the default `error.tsx` self-contained: render a minimal static 500 (no `LayerRendererPublic`, no `YcodeBadge`) so its client reference is ~1–2 KB.\n2. Load the custom 500 page tree only after an error occurs, from inside the boundary (`import()` in an effect), so its chunks never appear in `errorScripts`.\n3. Verify with `next build` + a published page: `errorScripts` should list only the tiny boundary chunk, and no two first-party chunks should share >50% of modules (`cmp` after masking `\\d{5,7}` IDs).\n\nSame check for `app/(site)/ycode/preview/error.tsx` and any `not-found.tsx` boundary — the pre-rendered `not-found` tree also carries a second copy of the site CSS (~230 KiB uncompressed) and is worth a separate look once this lands.\n\n## Out of scope (client side)\n\nThird-party tags (gtag ×2 ≈ 382 KB, Clarity, Tawk) account for all TBT and every long task; 2.7 MB of autoplay MP4 on mobile is bandwidth only and does not gate LCP.\n\nPart of #551 follow-up.\n","author":{"url":"https://github.com/ysamcode","@type":"Person","name":"ysamcode"},"datePublished":"2026-09-18T10:04:24Z","url":"https://github.com/ycode/ycode/issues/567"}
react-profiling 0 react-import-map react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 route-pattern /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) route-controller voltron_issues_fragments route-action issue_layout fetch-nonce v2:927e01c4-1496-2ae6-4502-7c0ccd131cf4 current-catalog-service-hash 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 request-id 97F2:F06EF:3FFA6:5568D:6AFE4129 html-safe-nonce a9b36f8c30c2dae625e259d68a74949362c9adde30f65a0ec249d88b8717d3ca visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5N0YyOkYwNkVGOjNGRkE2OjU1NjhEOjZBRkU0MTI5IiwidmlzaXRvcl9pZCI6IjU4NTYxOTk0MTE4MTM0NjY0MDkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== visitor-hmac 8b0803ecbd81504ac9380c6109479d5148cf44e9a9c92b6fa6fe6dcb48920f7c hovercard-subject-tag issue:5498303602 github-keyboard-shortcuts repository,issues,copilot google-site-verification Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I octolytics-url https://collector.github.com/github/collect analytics-location / fb:app_id 1401488693436528 apple-itunes-app app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/ycode/ycode/567/issue_layout twitter:image https://opengraph.githubassets.com/5068f1486032bd53a6292f1adc92a7193aaedcc71d290696badb0aadf64625d2/ycode/ycode/issues/567 twitter:card summary_large_image og:image https://opengraph.githubassets.com/5068f1486032bd53a6292f1adc92a7193aaedcc71d290696badb0aadf64625d2/ycode/ycode/issues/567 og:image:alt Summary Every published page still downloads and parses the error boundary's renderer chunks even though no error has occurred. Next injects the client-reference chunks of app/(site)/error.tsx into... og:image:width 1200 og:image:height 600 og:site_name GitHub og:type object og:author:username ysamcode hostname github.com expected-hostname github.com None f1a5901e2377b0af2a0b303f9528678f1475d04b9219dca1e993344196eaa07c turbo-cache-control no-preview go-import github.com/ycode/ycode git https://github.com/ycode/ycode.git octolytics-dimension-user_id 65892203 octolytics-dimension-user_login ycode octolytics-dimension-repository_id 1165452593 octolytics-dimension-repository_nwo ycode/ycode octolytics-dimension-repository_public true octolytics-dimension-repository_is_fork false octolytics-dimension-repository_network_root_id 1165452593 octolytics-dimension-repository_network_root_nwo ycode/ycode turbo-body-classes logged-out env-production page-responsive disable-turbo false browser-stats-url https://api.github.com/_private/browser/stats browser-errors-url https://api.github.com/_private/browser/errors release c4447fdce9ed0f33af959d2b6680d0bc18212a6a ui-target full theme-color #1e2327 color-scheme light dark react-app-name issues
URLs of crawlers that visited me.