Skip to content

bug(Table): Angular 9: caching column definitions breaks nesting tables #18768

@dtarjeft

Description

@dtarjeft

Reproduction

Steps to reproduce:

  1. Open this StackBlitz from this StackOverflow answer regarding nested material tables using Angular 8.
  2. Observe that clicking on table rows causes the table to expand/collapse and show nested data.
  3. Upgrade Angular to 9.0.5. For convenience, here's a StackBlitz with this completed.

Expected Behavior

Nested material tables in each mat-row with those columns defined, opening and closing as intended. No errors.

Actual Behavior

Expanding a row works the first time, then fails, leaving the table in a bad state throwing errors to the effect of Duplicate column definition name provided - the expansion/collapse functionality completely stops working at this point.

One can work around this by creating a dummy component who's sole purpose is to pass the data to another instance of mat-table - I've shown this in a fork of the Angular 9 StackBlitz. Note: I didn't preserve the filters from the original StackBlitz, as that was not part of the functionality in question.

Environment

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

Metadata

Metadata

Assignees

Labels

P2The issue is important to a large percentage of users, with a workaround

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions