Title: perf: make published pages lighter by trimming layer data by ysamcode · Pull Request #687 · ycode/ycode · GitHub
Open Graph Title: perf: make published pages lighter by trimming layer data by ysamcode · Pull Request #687 · ycode/ycode
X Title: perf: make published pages lighter by trimming layer data by ysamcode · Pull Request #687 · ycode/ycode
Description: Summary Published pages ship the layer tree a second time inside the RSC payload, and part of that tree is data the public renderer never reads. This removes those fields before the tree crosses the client boundary. Part of #685 (step 1, the quick trims). The issue estimates about 12% of the document on its sample homepage and 5–10% on the other sites it measured. Steps 2 and 3 are not included. Measurements Production build (next build + next start), homepage of a template with 15 interaction lists and 5 collection lists. The template has no components, so the _masterComponentId and componentOverrides trims are not exercised here. Homepage Before After Saved Document, clean build 167,112 B 154,758 B 12,354 B (7.4%) Document, rebuild with existing .next cache 162,385 B 151,447 B 10,938 B (6.7%) Flight payload, clean build 112,099 B 99,745 B 12,354 B (11.0%) Document gzipped, clean build 32,129 B 31,245 B 884 B (2.8%) Rendered markup is byte-identical before and after (53,416 B) The 15 interaction lists reaching the client are identical apart from Flight back-reference paths The saving comes from the flat animation list: Flight already sent each interaction list once and referenced it from the second tree, so what goes away is the skeleton of ancestor layers A page without interactions or components (the 404 page) is unchanged Changes Drop _masterComponentId from layers sent to the client: translations are baked in on the server, and the client only receives page/folder slug rows Drop componentOverrides and interactions from the rendered tree: overrides are applied on the server, and interactions reach the client through AnimationInitializer Send AnimationInitializer a flat list of the layers with interactions or settings.hidden, instead of the full tree skeleton Keep interactions and componentOverrides on the item templates of filterable and load-more collections: AnimationInitializer rebuilds injected items from those templates, and the filter/load-more API scans overrides for assets Leave the top-level hidden flag in place (open question in the issue): nothing in the repo writes it, but findLcpTextFont reads it Preview pages are unchanged; they still receive the full tree. Test plan Publish a large page and compare document and Flight size before and after with the commands from #685 Confirm the rendered markup of that page is unchanged Check load, scroll-into-view, hover and click animations, including a mobile menu toggle Check a hidden layer revealed by an interaction, and one with "Keep in HTML when hidden", across a breakpoint resize On a filterable collection and a load-more collection, confirm injected items render images from component overrides and still animate On a non-default locale, confirm component text, image alt text and translated media still render translated Check a component embedded in rich text still animates
Open Graph Description: Summary Published pages ship the layer tree a second time inside the RSC payload, and part of that tree is data the public renderer never reads. This removes those fields before the tree crosses th...
X Description: Summary Published pages ship the layer tree a second time inside the RSC payload, and part of that tree is data the public renderer never reads. This removes those fields before the tree crosses th...
Opengraph URL: https://github.com/ycode/ycode/pull/687
X: @github
Domain: github.com
| 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 | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:058f9e9f-9949-9aa5-7e03-360c9432b597 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 855E:1127A8:236A73:2E5EDD:6AFE597E |
| html-safe-nonce | 135f842413edb0e99c7fa10eb32e69f03eb951cb199e081d87f1a2a860d858c7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NTVFOjExMjdBODoyMzZBNzM6MkU1RUREOjZBRkU1OTdFIiwidmlzaXRvcl9pZCI6IjEwMTExOTEzOTk1NjQ4NTk3NzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 51f7f191bd6e6bb44d036e55561c08a307ba0cbc36f2d7e5ebc9d1c85d52851c |
| hovercard-subject-tag | pull_request:5353986994 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/ycode/ycode/pull/687/files |
| twitter:image | https://avatars.githubusercontent.com/u/7631193?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/7631193?s=400&v=4 |
| og:image:alt | Summary Published pages ship the layer tree a second time inside the RSC payload, and part of that tree is data the public renderer never reads. This removes those fields before the tree crosses th... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width