[mat-tree] Nodes are not updated correctly with trackyBy function set
- 主要语言
- TypeScript
- 星标
- 25k
- 派生
- 6.8k
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 91
描述
#### 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.
贡献指南
调研方向
从链接的 StackBlitz 复现开始,并比较在使用 trackBy 函数时 MatTree 与 ngFor 的行为。查看相关 issue #7877,并验证替换节点数组会更新渲染模板中的已更改属性,同时保留已跟踪的节点。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- angular, typescript
- 领域
- frontend
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100