Multiple react re-renderings when updating tree data
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- react
- Lĩnh vực
- frontend, performance
Hướng nghiên cứu
Bắt đầu với bản tái hiện CodeSandbox được liên kết và ví dụ trong cửa sổ riêng, sau đó xác minh số lần render khi mở rộng cây và chuyển đổi một phần tử. Được xem là hoàn tất khi bản cập nhật được tái hiện gây ra một lần render rc-tree trong khi vẫn giữ lại lần render CustomTreeNode duy nhất được báo cáo là đúng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Disclaimer: I use the term re-renderings. By this term here I mean react re-renderings and not browser re-renderings.
I have prepared a code example to reproduce the issue: codesandbox
Code example can be tested in separate window: separate window
Steps to reproduce:
- Expand all Elements
- Toggle Switch Button of single Element
- Internally: object
treeDatawill be completely recalculated and passed into rc-tree component - Expected results:
- I expect here, that rc-tree will be re-rendered 1 time (because
treeDatahas changed) - I expect here, that only single
CustomTreeNodewill be re-rendered, whichSwitchcomponent I have toggled on step 2.
- I expect here, that rc-tree will be re-rendered 1 time (because
- Actual results:
- rc-tree component re-rendered 3 times instead of 1 -> NOK
- only one
CustomTreeNodewill be re-rendered -> OK
Example video:
https://github.com/react-component/tree/assets/8103060/78917bcd-1e21-48ce-907a-4cc2082ff8d7
Duration of re-renderings from the video for rc-tree and all of its descendants:
- re-rendering no.1: 11.6 ms
- re-rendering no.2: 6.1 ms
- re-rendering no.3: 13.5 ms
Re-rendering screenshots
Re-rendering no.1:
Re-rendering no.2:
Re-rendering no.3:
My questions are:
- Is this a known behavior?
- Is it possible to fix it? (reduce number of re-renderings from 3 to 1. This should improve performance dramatically (11.6ms vs 31.2 ms - almost 3 times faster)
Thank you for your work and thank you in advance
- Ngôn ngữ chính
- TypeScript
- Star
- 1.3k
- Fork
- 490
- Merge trung bình
- 42 phút
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của react-component/tree
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 55/100
react-component/tree#1068 · 1 bình luận ·
-
可以新增一个属性来控制节点上是否需要展示这个title吗?Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
react-component/tree#983 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
react-component/tree#937 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
react-component/tree#935 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
react-component/tree#929 ·
Tất cả issue của react-component/tree
Issue tương tự
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
inu-appcenter/memorIN-frontend#106 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
kind/bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 7 ngày
-
[Bug] @deck.gl/arcgis dist import resolves to unpublished @deck.gl/core source path (9.3.11, 9.4.0)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
fix: CopyFilters ignores tabĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
CSCfi/sd-search-ui#145 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add: Cbeebies pl SDĐang mởcheck:passed streams:add
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày