angular / angular/components

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

オープン
#29,349 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
area: cdk/tree P3
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

src/example/tree-dynamic-example.html にあるリンク先の StackBlitz 再現環境から始め、次のシーケンスを再現します。`a` を押して insertNode を呼び出し、続けて `r` を押して初期データを復元します。挿入後に Material Tree がデータ更新をどのように処理するかを追跡します。復元されたデータ配列内のノードだけが表示され、ゴーストノードが存在しなければ完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。