From 561f6e23cba8b4da840128cd38c528a3f4506e77 Mon Sep 17 00:00:00 2001 From: Andrew Seguin Date: Wed, 13 Nov 2024 13:30:47 -0700 Subject: [PATCH 1/2] fix(cdk/table): run differ for all columns --- src/cdk/table/table.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cdk/table/table.ts b/src/cdk/table/table.ts index 7d0b5141a200..d25529219bf3 100644 --- a/src/cdk/table/table.ts +++ b/src/cdk/table/table.ts @@ -1085,7 +1085,10 @@ export class CdkTable * re-render that section. */ private _renderUpdatedColumns(): boolean { - const columnsDiffReducer = (acc: boolean, def: BaseRowDef) => acc || !!def.getColumnsDiff(); + const columnsDiffReducer = (acc: boolean, def: BaseRowDef) => { + const diff = !!def.getColumnsDiff(); + return acc || diff; + }; // Force re-render data rows if the list of column definitions have changed. const dataColumnsChanged = this._rowDefs.reduce(columnsDiffReducer, false); From bd700d29d3dcdca5ffc486a8a18cf8861f9dca28 Mon Sep 17 00:00:00 2001 From: Andrew Seguin Date: Thu, 14 Nov 2024 10:23:40 -0700 Subject: [PATCH 2/2] fix(cdk/table): include comment --- src/cdk/table/table.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cdk/table/table.ts b/src/cdk/table/table.ts index d25529219bf3..56c416ab560d 100644 --- a/src/cdk/table/table.ts +++ b/src/cdk/table/table.ts @@ -1086,6 +1086,8 @@ export class CdkTable */ private _renderUpdatedColumns(): boolean { const columnsDiffReducer = (acc: boolean, def: BaseRowDef) => { + // The differ should be run for every column, even if `acc` is already + // true (see #29922) const diff = !!def.getColumnsDiff(); return acc || diff; };