reactjs / reactjs/react.dev

[Typo]: The mechanism described in "Providing a fallback for server errors and client-only content" behaves differently in practice

Đang mở Phù hợp với người mới
#8,497 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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

type: typos
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ả

Summary

The section "Providing a fallback for server errors and client-only content" could be misleading when it comes to opting out of server-rendering.

Page

https://react.dev/reference/react/Suspense#providing-a-fallback-for-server-errors-and-client-only-content

Details

The section "Providing a fallback for server errors and client-only content" seems to suggest that if a user wants to explicitly opt out a component/hook out of being rendered on the server, they can throw an error on the server, and when that same component successfully renders on the client, the error will not be surfaced to the user. I am specifically talking about the following statements:

However, if it does not error on the client, React will not display the error to the user since the content was eventually displayed successfully.

You can use this to opt out some components from rendering on the server. To do this, throw an error in the server environment and then wrap them in a boundary to replace their HTML with fallbacks:

That seems to be in opposition to how React behaves in practice. Both in development and in production, the error thrown on the server is surfaced to the developer, and (arguably) the end user through the browser console (Minified error description: https://react.dev/errors/419).

Image

The seems to be no documented way to distinguish an intended opt-out from a user error, and if there is none, I feel like the documentation is a bit misleading.

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 phần tham chiếu của React Suspense “Providing a fallback for server errors and client-only content”, đặc biệt là hai phát biểu được trích dẫn về lỗi máy chủ và việc chọn không thực hiện kết xuất phía máy chủ. Tái hiện hoặc xác minh hành vi được báo cáo trong môi trường phát triển và production, bao gồm lỗi 419, sau đó cập nhật phần này để phần giải thích khớp với hành vi đã quan sát và nêu rõ mọi giới hạn hoặc cách tiếp cận được hỗ trợ.

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
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
68/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.