bug(MatTree): padding is not recomputed when moving a node inside/outside an expandable node
- 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
As `TreeControl` is deprecated, I started migrating to the latest API using `childrenAccessor`. So far so good, except for one case not working any more.
I'm using `matTreeNodePadding` and `matTreeNodePaddingIndent` on ``. When I move a node inside/outside of an expandable node, padding is not recomputed as-is.
Expanding/collapsing the parent node in which the node was moved, will recompute its padding though.
### Reproduction
Minimal example on [Stackblitz](https://stackblitz.com/~/github.com/poirierlouis/ng-issue-29959).
Steps to reproduce:
1. Open link
2. Open preview in a new tab
3. Open both folders (`/` and `home`)
4. Follow instructions to move a node outside its parent node
`dataSource` is updated with a new array, using the same items. Can it be a source of error? Should the entire tree be cloned somehow, to trigger changes detection down to padding computation?
### Expected Behavior
When a node is moved inside/outside of an expandable node (level is changed), padding should be recomputed based on the new level of the node.
### Actual Behavior
Padding of the node is not updated when moving the node inside/outside of an expandable node.
### Environment
- Angular: 18.2.10
- CDK/Material: 18.2.11
- Browser(s): Firefox / Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows
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à kiểm tra hành vi của matTreeNodePadding khi sử dụng childrenAccessor và di chuyển một nút giữa các nút cha có thể mở rộng. Theo dõi cách cấp của nút thay đổi và cách padding được tính lại, sau đó xác minh rằng việc di chuyển nút cập nhật padding của nó mà không mở rộng hoặc thu gọn nút cha.
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
- 48/100