Skip to content

bug(mat-table): mat-table not reliably updating with [dataSource] changes when using computed signals within @for loop #31515

@NsdHSO

Description

@NsdHSO

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 rendering multiple instances of mat-table within an @for loop, and each mat-table's [dataSource] is bound to a nested signal (or a signal-derived value) which itself contains the data array, mat-table sometimes fails to detect changes to the underlying data array, particularly when pagination changes occur. This leads to the table not re-rendering its rows even though the data array reference passed to [dataSource] has been updated.

Reproduction

StackBlitz link: https://stackblitz.com/edit/kusakedc?file=src/example/table-basic-example.html,src/example/table-basic-example.ts,package.json

Expected Behavior

mat-table should reliably detect changes to its [dataSource] input (when the array reference changes) and re-render its rows to reflect the new data, regardless of how deeply nested the signal-driven data is, as long as the final array reference for [dataSource] changes.

Actual Behavior

Don't take the itself instance

Environment

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

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