angular / angular/components

bug(cdk-virtual-scroll): use ngIf inside cdk-virtual-scroll-viewport break cdkVirtualFor render datas

Open
#21,793 5 comments 3 reactions 0 assignees View on GitHub
area: cdk/scrolling P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

#### Reproduction

https://stackblitz.com/edit/angular-zsbplw-8een6b?file=src/app/cdk-virtual-scroll-context-example.html

Steps to reproduce:
1. click empty button
2. click rebuild button (datas no render)
3. refresh, click empty button and then click rebuild more datas button (datas render correct)
![dada222](https://user-images.githubusercontent.com/8691013/106785430-586c2580-6688-11eb-86b9-45029fd714b6.gif)


#### Expected Behavior

What behavior were you expecting to see?
datas should render correct

#### Actual Behavior

What behavior did you actually see?
no datas render

#### Environment

- Angular: 11.1.1
- CDK/Material: 11.1.1
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction, especially src/app/cdk-virtual-scroll-context-example.html and the cdk-virtual-scroll-viewport/cdkVirtualFor entry points. Reproduce the empty-button then rebuild sequence, and compare it with the refresh/more-data sequence. Done means virtual-scroll data renders correctly in both sequences.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.