Skip to content

Fix inlineCss re-inlining stylesheets for the global error boundary - #98136

Open
akash-dabhi-qed wants to merge 1 commit into
vercel:canaryfrom
akash-dabhi-qed:fix/98110-inline-css-duplication
Open

Fix inlineCss re-inlining stylesheets for the global error boundary#98136
akash-dabhi-qed wants to merge 1 commit into
vercel:canaryfrom
akash-dabhi-qed:fix/98110-inline-css-duplication

Conversation

@akash-dabhi-qed

@akash-dabhi-qed akash-dabhi-qed commented Sep 1, 2026

Copy link
Copy Markdown

What?

Previously we got stylesheet embeded thrice via inlineCss, 2 of them were documented and needed, the third came from a global error boundary. The app-renderer now limits the stylesheet data to the two documented copies.

Why?

One copy of inlineCss previous embeddings weighed 3x for turbopack, when only 2x of useful data was needed, the pr fixes this, it removes the redundant copy of data.

How?

Following changes were made to resolve the issue:

  • getRSCPayload passes ctx.inlinedCSSPaths, while getErrorRSCPayload passes a fresh Set(), since that document renders an error shell rather than the loader tree and shares ctx with the render that usually just failed.
  • AppRenderContext gained inlinedCSSPaths: Set<string>, one per request.
  • The two places that emit a stylesheet: getLayerAssets and createComponentStylesAndScripts, now record each emitted path into it.
  • getGlobalErrorStyles takes the inlined set as an explicit argument and consults it.

Result: global-error skips sheets the document already has, and the G entry becomes "G":["$f",[]].

Fixes #98110

@akash-dabhi-qed
akash-dabhi-qed force-pushed the fix/98110-inline-css-duplication branch from 981327d to c5f972e Compare September 1, 2026 12:56
@akash-dabhi-qed
akash-dabhi-qed force-pushed the fix/98110-inline-css-duplication branch from c5f972e to 96469c3 Compare September 1, 2026 13:04
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.

experimental.inlineCss embeds the full stylesheet 3x per page — getGlobalErrorStyles re-inlines it with an empty injectedCSS set

1 participant