bug(cdk-tree): CDK Tree can't be opened when trackBy function is used after update of datasource
- 主要言語
- TypeScript
- スター
- 25k
- フォーク
- 6.8k
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 91
説明
### Is this a regression?
- [x] Yes, this behavior used to work in the previous version
### The previous version in which this bug was not present was
Angular 17 (here is the same example: https://stackblitz.com/edit/zmfrj6ks?file=src%2Fexample%2Fcdk-tree-nested-example.ts,src%2Fexample%2Fcdk-tree-nested-example.html with Angular 17)
### Description
Hi, there is a bug in the Angular CDK Tree. When you update the data of the tree and a trackBy function is given to the tree, you can't interact with the tree anymore.
### Reproduction
StackBlitz link: https://stackblitz.com/edit/fesfbplt?file=src%2Fexample%2Fcdk-tree-nested-children-accessor-example.html
Steps to reproduce:
1. interact with the tree (not mandatory, but you see that it works)
2. click on "changeTree" button
3. try to open the tree again => this doesn't work
### Expected Behavior
Tree should be updateable and interactive after an update. I would also expect that the open state is kept when only part of the tree is changed (in the example one subtree is removed, the other persists) and a trackby function is given.
### Actual Behavior
Tree is closed and not interactive anymore.
### Environment
- Angular: 18/19
- CDK/Material: 18/19
- Browser(s): all
- Operating System (e.g. Windows, macOS, Ubuntu): windows
コントリビューションガイド
調査の方向性
リンクされた StackBlitz の再現と、trackBy 関数および datasource の更新に関する Angular CDK Tree の動作から始めます。changeTree シーケンスを再現し、その後、データの更新とインタラクション状態の保持に関係する CDK Tree のエントリポイントを追跡します。更新後もツリーがインタラクティブなままで、変更されていないサブツリーの開いた状態が保持されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- angular, typescript
- 領域
- frontend
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100