angular / angular/components

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

Abierto
#29,349 0 comentarios 0 reacciones 0 asignados Ver en GitHub
area: cdk/tree P3
Lenguaje dominante
TypeScript
Estrellas
25k
Forks
6.8k
Merge medio
1 d 8 h
PR fusionados (30 d)
91

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con la reproducción vinculada de StackBlitz en src/example/tree-dynamic-example.html y reproduce la secuencia: pulsa `a` para llamar a insertNode y después `r` para restaurar los datos iniciales. Traza cómo Material Tree gestiona la actualización de datos después de la inserción; se considera terminado cuando solo permanecen visibles los nodos del array de datos restaurado, sin ningún nodo fantasma.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
angular, typescript
Área
frontend
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.