[mat-tree] Nodes are not updated correctly with trackyBy function set
- Ngôn ngữ chính
- TypeScript
- Star
- 25k
- Fork
- 6.8k
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 91
Mô tả
#### Bug, feature request, or proposal:
MatTree does not reflect the changes to the nodes if trackBy function is used. For example, I have several items with trackBy function pointing to their "id" property. If I provide a new array with completely same ids, but with changes to some of the other properties, change detection does not occur.
#### What is the expected behavior?
When used with trackBy function MatTree should trigger change detection on all nodes, just like ngFor with trackBy does.
#### What is the current behavior?
No changes are detected therefore data is not updated in template.
#### What are the steps to reproduce?
https://stackblitz.com/edit/angular-material2-issue-z8ubtt
#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Latest versions of Angular, Material (check StackBlitz). Any browser.
#### Is there anything else we should know?
Same [issue](https://github.com/angular/material2/issues/7877) was observed last year with MatTable.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với bản tái hiện StackBlitz được liên kết và so sánh hành vi của MatTree với ngFor khi sử dụng hàm trackBy. Xem lại issue liên quan #7877 và xác minh rằng việc thay thế mảng node sẽ cập nhật các thuộc tính đã thay đổi trong template được render, đồng thời giữ lại các node được theo dõi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- angular, typescript
- Lĩnh vực
- 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