From 94d4f13951d5f4b9d22a0f57f15f76c82d6bb6a4 Mon Sep 17 00:00:00 2001 From: anthonyrgreen Date: Thu, 24 Oct 2024 18:02:40 -0400 Subject: [PATCH] Fix header rerender bug which occurs when a table has two header rows updated simultaneously. This is a proposed solution to https://github.com/angular/angular/issues/58347. --- 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 f287b9adb8b9..08dac1d5eaf2 100644 --- a/src/cdk/table/table.ts +++ b/src/cdk/table/table.ts @@ -1084,7 +1084,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);