angular / angular/components

bug(CDK/SCROLLING): <object> element in *cdkVirtualFor is glitching when using "templateCacheSize: 0"

オープン
#28,021 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る
area: cdk/scrolling P4
主要言語
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

When using No cache strategy (templateCacheSize: 0) for *cdkVirtualFor with element (as image), elements of list glitch while scrolling. Seems like cdkVirtualFor incorrectly init/reinit or reuse instances of listed elements.

When using tag instead of no bug detected.

### Reproduction

StackBlitz link: https://stackblitz.com/edit/uyv2wg?file=src%2Fexample%2Fcdk-virtual-scroll-template-cache-example.html
Steps to reproduce:
1. Create list of 100 elements, use with image link data.
2. Scroll

### Expected Behavior

Smooth scrolling, correct reusing/reinit of list elements, no content replacing.

### Actual Behavior

Scrolling is not smooth (end sometimes end / start of list is unreachable), elements in list are replaced by content of sibling.

### Environment

- Angular: 17.0.0-rc.0 (and 15)
- CDK/Material: 16.2.10
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): macOs

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

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

調査の方向性

リンクされている StackBlitz の再現から始め、templateCacheSize: 0 と object image elements を指定した cdkVirtualFor を使って Chrome での動作を確認します。template の再利用に関する CDK の仮想スクロール実装を読み、img のケースと比較します。スクロールが滑らかで、リストのすべての項目に到達でき、コンテンツが兄弟要素に置き換えられなければ完了です。

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

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

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

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