Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React SSR Streaming Bug #4289

Open
chin2km opened this issue Apr 7, 2024 · 0 comments
Open

React SSR Streaming Bug #4289

chin2km opened this issue Apr 7, 2024 · 0 comments

Comments

@chin2km
Copy link

chin2km commented Apr 7, 2024

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:

  • OS: macOS 14.1
  • CPU: (10) arm64 Apple M1 Pro
  • Memory: 3.11 GB / 32.00 GB
  • Shell: 5.9 - /bin/zsh

Binaries:

  • Node: 20.0.0 - ~/.nodenv/versions/20.0.0/bin/node
  • Yarn: 1.22.22 - ~/.nodenv/versions/20.0.0/bin/yarn
  • npm: 9.6.4 - ~/.nodenv/versions/20.0.0/bin/npm
  • pnpm: 8.15.6 - ~/.nodenv/versions/20.0.0/bin/pnpm
  • bun: 0.1.10 - ~/.bun/bin/bun

npmPackages:

  • babel-plugin-styled-components: 2.1.4 => 2.1.4
  • styled-components: 6.1.8 => 6.1.8

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 <style> tags at wrong points in the html stream.

Screenshot 2024-04-07 at 3 21 49 PM
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

No branches or pull requests

1 participant