René's URL Explorer Experiment


Title: Published pages ship the layer tree twice, making large pages 0.7–0.9 MB · Issue #685 · ycode/ycode · GitHub

Open Graph Title: Published pages ship the layer tree twice, making large pages 0.7–0.9 MB · Issue #685 · ycode/ycode

X Title: Published pages ship the layer tree twice, making large pages 0.7–0.9 MB · Issue #685 · ycode/ycode

Description: Summary Every published page is shipped twice: once as HTML and once as the RSC Flight payload that LayerRendererPublic (a 'use client' component) needs to render the same page again. The layer tree JSON in that payload is larger than th...

Open Graph Description: Summary Every published page is shipped twice: once as HTML and once as the RSC Flight payload that LayerRendererPublic (a 'use client' component) needs to render the same page again. The layer tre...

X Description: Summary Every published page is shipped twice: once as HTML and once as the RSC Flight payload that LayerRendererPublic (a 'use client' component) needs to render the same page again. The l...

Opengraph URL: https://github.com/ycode/ycode/issues/685

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Published pages ship the layer tree twice, making large pages 0.7–0.9 MB","articleBody":"## Summary\n\nEvery published page is shipped twice: once as HTML and once as the RSC Flight payload that `LayerRendererPublic` (a `'use client'` component) needs to render the same page again. The layer tree JSON in that payload is larger than the markup it produces, so a large homepage is 0.7–0.9 MB of uncompressed HTML, of which about two thirds is Flight data.\n\nFollows #447, which removed unused component definitions from the payload.\n\n## Measurements\n\nA large published homepage (about 900 layers):\n\n| Part | Uncompressed |\n|---|---|\n| Whole HTML document | 915 KB |\n| Visible markup | 279 KB |\n| Flight payload (`self.__next_f`) | 619 KB |\n| – `layers` prop of `LayerRendererPublic` | 417 KB |\n| – `layers` prop of `AnimationInitializer` | 56 KB |\n| – other props (`pages`, `serverSettings`, `resolvedAssets`, …), custom code, head | ~140 KB |\n\nThree other sites show the same pattern: Flight is 64–70% of the document. Over the wire the impact is smaller (this page is 96 KB with Brotli, 138 KB with gzip), because Brotli catches part of the duplication. Clients that don't send `Accept-Encoding` (uptime monitors, some crawlers) get the full 915 KB on every request.\n\nInside the main `layers` prop the largest fields are `variables` (129 KB: icon SVG strings, Tiptap text docs, links), `classes` (98 KB), `_masterComponentId` (39 KB), `id` (36 KB), `interactions` (22 KB), `settings` (21 KB) and `componentOverrides` (19 KB).\n\n## Proposal\n\n### 1. Quick trims (low risk, `PageRenderer.tsx` only)\n\nAbout 110 KB (12%) on the page above, 5–10% on the others.\n\n- **Drop `_masterComponentId` in `stripSSROnlyData`.** The client only reads it for translation lookups, and published pages already bake translations into the layers and pass only page/folder slug rows (`clientLinkTranslations`).\n- **Drop `componentOverrides` in `stripSSROnlyData`.** Overrides are applied on the server, and `LayerRendererPublic` never reads them.\n- **Make `extractAnimationLayers` return a flat list.** `AnimationInitializer` only collects layers with `interactions` or `settings.hidden`; it never uses the tree structure (collection extras arrive via `ITEMS_INJECTED_EVENT`). On the page above that is 9 of 485 layers. Returning just those, without the skeleton, takes the prop from 56 KB to about 25 KB.\n- **Drop `interactions` from the main tree.** `LayerRendererPublic` only reads them for rich-text-embedded components (`layerTreeHasInteractions` on `_resolvedLayers`, which live in variables and are unaffected). Today the animation prop references the main tree's `interactions` objects (`$\u003crow>:…` refs), so they would move into the animation prop rather than disappear, which is fine once that prop is flat.\n- **Open question:** 572 of 902 layers carry a top-level `hidden: true` while rendering normally, and the public renderer never reads `layer.hidden` (only `settings.hidden`). It looks like a leftover builder flag. Confirm before stripping it (8 KB).\n\n### 2. Render static layers as Server Components (medium, about 30–40% of Flight)\n\nSplit `LayerRendererPublic` so static layers (text, images, icons, plain divs, links) render on the server and only interactive subtrees (forms, sliders, lightbox, filters, load more, locale selector, password form, maps) are client components with their own slim props. Static content would then be serialized as rendered elements instead of layer JSON plus the props needed to resolve it (`pages`, `folders`, `resolvedAssets`, `serverSettings`, `collectionItemSlugs`).\n\nThe App Router still embeds server-rendered output in Flight, so the page body is still duplicated, but at roughly markup size instead of 1.5× markup.\n\n### 3. Published pages without Flight (large, about 65% of the document)\n\nServe published pages as plain HTML with no RSC payload, and hydrate only the interactive islands, for example with small `hydrateRoot` entry points keyed by `data-layer-id`. That removes the duplication entirely (915 KB → ~300 KB on the page above). It needs a separate rendering path for published pages and touches caching/ISR, interactions, forms, filters and error pages, so it should be scoped on its own.\n\n## Suggested order\n\n1 now, 2 as a follow-up, 3 only if 2 is not enough.\n\n## How to measure\n\n```bash\ncurl -s https://\u003csite>/ -o page.html\n# total size, Flight size\nwc -c page.html\ngrep -o '\u003cscript>self.__next_f.push(.*\\?)\u003c/script>' page.html | wc -c\n```\n","author":{"url":"https://github.com/ysamcode","@type":"Person","name":"ysamcode"},"datePublished":"2026-11-17T08:45:07Z","url":"https://github.com/ycode/ycode/issues/685"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:09aa782f-838f-efa1-e549-017cb214f45c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id82AE:1C7627:34415:4731B:6AFE30A2
html-safe-nonce425e66fef1415f89fb53754481e390f44da922f1a77bdc62ef2fb1da1bc2448e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MkFFOjFDNzYyNzozNDQxNTo0NzMxQjo2QUZFMzBBMiIsInZpc2l0b3JfaWQiOiIzMzg4ODI3OTYxMTEyMDE1MDEwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac674ebd27fc14538ec21e15ea49312bd936d7d18afc8ba597ec910371b74c7360
hovercard-subject-tagissue:6440780286
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/ycode/ycode/685/issue_layout
twitter:imagehttps://opengraph.githubassets.com/2e32fa4da712bca1bc1d2ed8f1f3bba3025ab77bbd3837978a7872700568ddca/ycode/ycode/issues/685
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/2e32fa4da712bca1bc1d2ed8f1f3bba3025ab77bbd3837978a7872700568ddca/ycode/ycode/issues/685
og:image:altSummary Every published page is shipped twice: once as HTML and once as the RSC Flight payload that LayerRendererPublic (a 'use client' component) needs to render the same page again. The layer tre...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameysamcode
hostnamegithub.com
expected-hostnamegithub.com
Noned70e31220a67f6376c108d2416fa8e7df854c1065b1672ab7a88ab6dc3a809e2
turbo-cache-controlno-preview
go-importgithub.com/ycode/ycode git https://github.com/ycode/ycode.git
octolytics-dimension-user_id65892203
octolytics-dimension-user_loginycode
octolytics-dimension-repository_id1165452593
octolytics-dimension-repository_nwoycode/ycode
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1165452593
octolytics-dimension-repository_network_root_nwoycode/ycode
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseccb88d9c92abe69245b429398c8a57ae87070c7c
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/ycode/ycode/issues/685#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fycode%2Fycode%2Fissues%2F685
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fycode%2Fycode%2Fissues%2F685
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=ycode%2Fycode
Reloadhttps://github.com/ycode/ycode/issues/685
Reloadhttps://github.com/ycode/ycode/issues/685
Reloadhttps://github.com/ycode/ycode/issues/685
ycodehttps://github.com/ycode
ycodehttps://github.com/ycode/ycode
Codehttps://github.com/ycode/ycode
Issues7 (7)https://github.com/ycode/ycode/issues
Pull requests1 (1)https://github.com/ycode/ycode/pulls
Discussionshttps://github.com/ycode/ycode/discussions
Actionshttps://github.com/ycode/ycode/actions
Projectshttps://github.com/ycode/ycode/projects
Security and quality1 (1)https://github.com/ycode/ycode/security
Insightshttps://github.com/ycode/ycode/insights
https://github.com/ycode/ycode
New issuehttps://github.com/login?return_to=https://github.com/ycode/ycode/issues/685
New issuehttps://github.com/login?return_to=https://github.com/ycode/ycode/issues/685
Published pages ship the layer tree twice, making large pages 0.7–0.9 MBhttps://github.com/ycode/ycode/issues/685#top
https://github.com/ysamcode
ImprovementImprove existing featurehttps://github.com/ycode/ycode/issues?q=state%3Aopen%20label%3A%22Improvement%22
https://github.com/ysamcode
ysamcodehttps://github.com/ysamcode
on Nov 17, 2026https://github.com/ycode/ycode/issues/685#issue-6440780286
#447https://github.com/ycode/ycode/issues/447
ysamcodehttps://github.com/ysamcode
on Nov 17, 2026https://github.com/ycode/ycode/issues/685#event-36382864432
ysamcodehttps://github.com/ysamcode
ImprovementImprove existing featurehttps://github.com/ycode/ycode/issues?q=state%3Aopen%20label%3A%22Improvement%22
on Nov 17, 2026https://github.com/ycode/ycode/issues/685#event-36382866917
Mih2026-ycodehttps://github.com/Mih2026-ycode
on Nov 17, 2026https://github.com/ycode/ycode/issues/685#event-36412171878
perf: trim layer data sent to published pageshttps://github.com/Mih2026-ycode/ycode/commit/aac10fe7eb2fac40cb71f5b988f733efc961b3f9
aac10fehttps://github.com/Mih2026-ycode/ycode/commit/aac10fe7eb2fac40cb71f5b988f733efc961b3f9
ysamcodehttps://github.com/ysamcode
completedhttps://github.com/ycode/ycode/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Nov 17, 2026https://github.com/ycode/ycode/issues/685#event-36413444869
Sign up for freehttps://github.com/signup?return_to=https://github.com/ycode/ycode/issues/685
Sign in to commenthttps://github.com/login?return_to=https://github.com/ycode/ycode/issues/685
ysamcodehttps://github.com/ysamcode
ImprovementImprove existing featurehttps://github.com/ycode/ycode/issues?q=state%3Aopen%20label%3A%22Improvement%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.