next.js
d10c6b80 - fix(app-render): prevent double CSS insertion with inlineCss

Commit
104 days ago
fix(app-render): prevent double CSS insertion with inlineCss When `experimental.inlineCss` is enabled, CSS content was being sent twice on initial page load: once as `<style>` tags in the HTML `<head>` and again as serialized elements in the RSC inline payload. This fix introduces a CSS collection mechanism that captures inline CSS during component tree construction and injects it via ServerInsertedHTML instead of rendering `<style>` elements in the RSC tree. This ensures CSS appears only in the HTML output, not in the serialized RSC payload. Changes: - Add CollectedInlineCss type to collect CSS data - Modify renderCssResource to collect CSS instead of rendering when collectedInlineCss is provided - Update makeGetServerInsertedHTML to render collected CSS - Wire collectedInlineCss through the render pipeline - Add test to verify CSS is not in RSC inline payload
Author
Parents
Loading