bug(material/tree): node added with insertNode remains visible after dataSource is updated
- 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ả
### Is this a regression?
- [ ] Yes, this behavior used to work in the previous version
### The previous version in which this bug was not present was
_No response_
### Description
I'm using Material Tree and `insertNode` method to create a node inside the tree menu.
### Reproduction
[StackBlitz link]( https://stackblitz.com/edit/eksxnj-u1duzq?file=src%2Fexample%2Ftree-dynamic-example.html)
Steps to reproduce:
1. Open the app and focus inside the document
2. Press `a` to add a new node using `insertNode` method
3. Press `r` to restore the data to the initial state.
### Expected Behavior
I expect that when the `data` object is populated, only the nodes passed in this array should be on the interface.
### Actual Behavior
A ghost node is added.
### Environment
```sh
@angular-devkit/architect 0.1703.7
@angular-devkit/build-angular 17.3.7
@angular-devkit/core 17.3.7
@angular-devkit/schematics 17.3.7
@angular/cli 17.3.7
@schematics/angular 17.3.7
ng-packagr 17.3.0
rxjs 7.8.1
typescript 5.4.5
webpack 5.90.3
zone.js 0.14.5
```
This is also in v18.
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 tại src/example/tree-dynamic-example.html và tái hiện chuỗi sau: nhấn `a` để gọi insertNode, sau đó nhấn `r` để khôi phục dữ liệu ban đầu. Theo dõi cách Material Tree xử lý việc cập nhật dữ liệu sau khi chèn; được xem là hoàn tất khi chỉ các node trong mảng dữ liệu đã khôi phục còn hiển thị, không có node ma.
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
- 38/100