react-dom/server: clarify when `renderToPipeableStream` is appropriate
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 11.8k
- 派生
- 7.9k
- 平均合并
- 1 天 11 小时
- 30 天内合并 PR
- 11
描述
At https://reactjs.org/docs/react-dom-server.html#rendertopipeablestream we see this note:
This is a Node.js specific API and modern server environments should use renderToReadableStream instead.
I initially read this as saying "use renderToReadableStream in any environment where web streams are available." This includes modern versions of Node: https://nodejs.org/api/webstreams.html.
But going to the main React 18 release notes page https://reactjs.org/blog/2022/03/29/react-v18.html#react-dom-server, we see that there is a different distinction being made.
renderToPipeableStream: for streaming in Node environments.
renderToReadableStream: for modern edge runtime environments, such as Deno and Cloudflare workers.
(Aside: is Deno really an "edge runtime environment"? 🤔 )
Combined with @sebmarkbage's outlining of the downsides of web streams here https://github.com/reactwg/react-18/discussions/91, it seems clear that renderToPipeableStream should always be preferred in Node environments. It'd be nice if the docs clearly spelled this out.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从链接的 renderToPipeableStream 文档开始,并将其措辞与 React 18 发布说明以及链接的 web streams 讨论进行比较。明确 Node 环境与 edge runtime 之间的区别,并确认修订后的注释不再暗示现代 Node 应使用 renderToReadableStream。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, react
- 领域
- documentation
- Issue 类型
- 文档
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 58/100