react / react/react

[DevTools Bug]: Context display does not support HOC name tagging

Đang mở
#33,210 1 bình luận 3 reaction 0 người được giao Xem trên GitHub

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

Component: Developer Tools Status: Unconfirmed Type: Bug
Ngôn ngữ chính
JavaScript
Star
251k
Fork
51.4k
Merge trung bình
2 ngày 4 giờ
Pull request đã merge (30 ngày)
53

Mô tả

Repro steps

We're using HOCs as a way to tag components with certain concerns, this gives us the ability to trim the React Devtools tree to trim down on components that are irrelevant or out of scope (or even specifically in scope).

Image

This works well, except that the name parsing does not apply for named contexts:

const MyOverlayContext = createContext<ContextData | undefined>(undefined);
MyOverlayContext.displayName = 'overlay(MyOverlayContext)'
// shows up as overlay(MyOverlayContext).Provider, instead of MyOverlayContext.Provider [overlay]
() => <MyOverlayContext.Provider />

Image

(We're aware that this isn't how ExoticNamedComponent or HOCs are meant to be used, but they give us the ability to quickly search the tree for certain tags, quickly filter out many browser- or display-like nodes, like <Button />, ` and so on. If you're taking PRs, I would have a look at that, too.)

How often does this bug happen?

Every time

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 bằng cách tái hiện ví dụ named-context và lần theo quá trình phân tích tên hiển thị của context trong DevTools; báo cáo không xác định file hoặc test nào. Hoàn thành khi một context có displayName 'overlay(MyOverlayContext)' được hiển thị là MyOverlayContext.Provider [overlay], với coverage cho trường hợp được báo cáo.

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
devtools, frontend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/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.