resend / react-email

💌 Build and send emails using React
https://react.email
MIT License
12.57k stars 571 forks source link

chore(render): Use `renderToPipeableStream` instead of `renderToStaticNodeStream` #1443

Closed gabrielmfern closed 5 days ago

gabrielmfern commented 2 weeks ago

This is needed since React 18.3 deprecated renderToStaticNodeStream so they are going to remove it on React 19 meaning we need to move out of this function into something else.

From the actual warning given by react-dom ̇

Warning: ReactDOMServer.renderToStaticNodeStream() is deprecated. Use ReactDOMServer.renderToPipeableStream() and wait to pipe until the onAllReady callback has been called instead.

This PR does exactly as the warning recommends us to do, calling renderToPipeableStream and piping the stream once the onAllReady callback is called. Only piping it once onAllReady is called, makes it so that stuff like Suspense boundaries don't leave out trailing <script> tags.

vercel[bot] commented 2 weeks ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-email ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 9, 2024 2:18pm
react-email-demo ❌ Failed (Inspect) May 9, 2024 2:18pm