reactjs / reactjs/react.dev

react-dom/server: clarify when `renderToPipeableStream` is appropriate

Đang mở
#4,510 0 bình luận 2 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
JavaScript
Star
11.8k
Fork
7.9k
Merge trung bình
1 ngày 11 giờ
Pull request đã merge (30 ngày)
11

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với tài liệu được liên kết về renderToPipeableStream và so sánh cách diễn đạt của tài liệu đó với ghi chú phát hành React 18 và cuộc thảo luận được liên kết về web streams. Làm rõ sự khác biệt giữa các môi trường Node và edge runtime, đồng thời xác minh rằng ghi chú đã sửa không còn ngụ ý rằng Node hiện đại nên sử dụng renderToReadableStream.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, react
Lĩnh vực
documentation
Loại issue
Tài liệu
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
58/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.