Skip to content

bug(cdk-virtual-scroll-viewport): Virtual scroll keeps elements in memory on destruction #32632

@tibi0010

Description

@tibi0010

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

19.2.15

Description

Items wrapped in cdk-virtual-scroll-viewport persists in memory even after the destruction of the virtual scroll element.

Image Image

Reproduction

StackBlitz link: https://acasmhd5.stackblitz.io
Steps to reproduce:

  1. Click toggle button a couple of times
  2. Create a memory snapshot
  3. Check elements in the memory snapshot

Expected Behavior

cdk-virtual-scroll-viewport does a cleanup on destruction, does not retain elements.

Actual Behavior

cdk-virtual-scroll-viewport keep elements in memory even after destruction.

Environment

  • Angular: 20.2.0
  • CDK/Material: 20.2.0
  • Browser(s): Google Chrome 141.0.7390.108, Firefox 146.0.1
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions