angular / angular/components

bug(Virtual scrolling + Signals): When removing an element from the array it is not removed from the screen

Open
#27,291 2 comments 6 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

### 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 trying to use Virtual Scrolling with Signals when removing element, it is not removed from the screen. The bug only occurs using `*cdkVirtualFor`. If you use `*ngFor` the element is removed correctly.

### Reproduction

Ex:

HTML:
```



```

TS:
```
export type OrderColumn = { orders: Order[], total: number, page: number };
orderColumn: Signal;

```

### Expected Behavior

I expected that when removing an element from the orderColumn().orders array it would exit the screen.

### Actual Behavior

When removing an element, it continues to be rendered on screen.

### Environment

```
Angular CLI: 16.0.5
Node: 18.12.1
Package Manager: npm 8.19.2
OS: win32 x64

Angular: 16.0.5
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1600.5
@angular-devkit/build-angular 16.0.5
@angular-devkit/core 16.0.5
@angular-devkit/schematics 16.0.5
@angular/cdk 16.0.4
@angular/material 16.0.4
@schematics/angular 16.0.5
rxjs 7.5.7
typescript 5.0.4
````

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the provided Angular template using *cdkVirtualFor, Signals, and removal from orderColumn().orders, then compare it with *ngFor. Trace the virtual-scrolling update path and verify that removing an element causes the corresponding rendered item to leave the screen.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.