angular / angular/components

bug(material/tree): node added with insertNode remains visible after dataSource is updated

Aperta
#29,349 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
area: cdk/tree P3
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

### 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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con la riproduzione collegata di StackBlitz in src/example/tree-dynamic-example.html e riproduci la sequenza: premi `a` per chiamare insertNode, quindi `r` per ripristinare i dati iniziali. Traccia il modo in cui Material Tree gestisce l’aggiornamento dei dati dopo l’inserimento; il lavoro è completato quando rimangono visibili solo i nodi nell’array di dati ripristinato, senza nodi fantasma.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.