[mat-tree] Nodes are not updated correctly with trackyBy function set
- Vorherrschende Sprache
- TypeScript
- Sterne
- 25k
- Forks
- 6.8k
- Ø Merge
- 1 T. 8 Std.
- Gemergte PRs (30 T.)
- 91
Beschreibung
#### 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.
Beitragsleitfaden
Rechercherichtung
Beginne mit der verknüpften StackBlitz-Reproduktion und vergleiche das Verhalten von MatTree mit ngFor, wenn eine trackBy-Funktion verwendet wird. Prüfe das zugehörige Issue #7877 und verifiziere, dass das Ersetzen des Knoten-Arrays geänderte Eigenschaften im gerenderten Template aktualisiert und dabei getrackte Knoten beibehält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- angular, typescript
- Bereich
- frontend
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100