Repository navigation
Conversation
🦋 Changeset detectedLatest commit: eca5c9d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
c0fd2ce to
976f874
Compare
|
@gregorjan that would be a sweet thing to do, thanks for the proposal.
You could try running |
ErrorBoundary is a client component, so the full ComponentRendering it received was serialized into the RSC payload of every page - including each component's resolved datasource, fields and nested placeholders, for server components that had already rendered them to HTML. ErrorBoundary only displays componentName and uid, so narrow the rendering before passing it.
5a2b409 to
0ed7a62
Compare
|
@art-alexeyenko |
Problem
AppPlaceholderwraps every rendering it renders inErrorBoundary:ErrorBoundaryis a client component ('use client'), so every prop it receives is serialized into the RSC flight payload of the page — inline in the HTML and again in the.rscartifact. It reads exactly two fields offrendering:The object it is given carries
fields(the component's resolved datasource) andplaceholders(its whole nested subtree). For a server component that has already rendered that content to HTML, the same content is shipped a second time as JSON so that, if the component throws, a message can name it.Measured on one page of a production site (header + footer from Sitecore partial designs):
FooterHeaderFix
Narrow the rendering to the two fields before passing it.
ComponentRenderingrequires onlycomponentName, so this needs no type or public-API change.Result
Same page, production build, before → after:
Rendered output is byte-identical: same text, same 162
<a href>values. Datasource markers drop out of the payload ("datasource"5 → 0, GUIDs 54 → 15). For an ISR-cached site this is per stored page, so it multiplies by page count.The same code is present in 1.4.1, 2.4.0 and the current 3.0 canary.
Notes
componentNameanduid.eslintpasses on both changed files. I could not run the package's mocha suite locally —test/setup.jsregistersts-node/register/transpile-onlybut the specs load as ESM in my environment (ERR_UNKNOWN_FILE_EXTENSIONfor.tsx,ERR_MODULE_NOT_FOUNDfor extensionless imports), which reproduces ondevwithout my changes. Relying on CI for the suite; happy to adjust if it flags anything.Placeholder.tsx(the non-RSC placeholder) passes the rendering the same way. Its children are already client-side so the payload impact differs; left alone here to keep the change focused — glad to include it if you prefer.Opened as a draft for your review of the approach.