styled-components / styled-components

Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅
https://styled-components.com
MIT License
40.11k stars 2.48k forks source link

React SSR Streaming Bug #4289

Open chin2km opened 1 month ago

chin2km commented 1 month ago

React SSR Streaming bug

I have followed the documentation on react SSR streaming (doc) and endup having a broken generated html in styled-components v6. The same code works just fine in styled-components v5.3.5.

I understand that new streaming methods in React (renderToPipeableStream) is not supported yet in styled-components (issue). But renderToNodeStream is seemingly supported according to the docs but in practice its breaking.

Environment

System:

Reproduction

Minimal reproduction using webpack: https://github.com/chin2km/styled-components-react-streaming-bug

Steps to reproduce

start the application using yarn dev:ssr and the html generated for react streaming is broken.

Expected Behavior

it works just like when using renderToString

Actual Behavior

The generated html breaks the html by injecting the