Skip to content

Commit c234661

Browse files
committed
also remove separate "forced" changes
1 parent 253eb1e commit c234661

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

src/cdk/table/table.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -467,28 +467,22 @@ export class CdkTable<T> implements AfterContentChecked, CollectionViewer, OnDes
467467
// Render updates if the list of columns have been changed for the header, row, or footer defs.
468468
this._renderUpdatedColumns();
469469

470-
let forced = false;
471-
472470
// If the header row definition has been changed, trigger a render to the header row.
473471
if (this._headerRowDefChanged) {
474472
this._forceRenderHeaderRows();
475473
this._headerRowDefChanged = false;
476-
forced = true;
477474
}
478475

479476
// If the footer row definition has been changed, trigger a render to the footer row.
480477
if (this._footerRowDefChanged) {
481478
this._forceRenderFooterRows();
482479
this._footerRowDefChanged = false;
483-
forced = true;
484480
}
485481

486482
// If there is a data source and row definitions, connect to the data source unless a
487483
// connection has already been made.
488484
if (this.dataSource && this._rowDefs.length > 0 && !this._renderChangeSubscription) {
489485
this._observeRenderChanges();
490-
} else if (forced) {
491-
this.updateStickyColumnStyles();
492486
}
493487

494488
this._checkStickyStates();
@@ -797,27 +791,19 @@ export class CdkTable<T> implements AfterContentChecked, CollectionViewer, OnDes
797791
*/
798792
private _renderUpdatedColumns() {
799793
const columnsDiffReducer = (acc: boolean, def: BaseRowDef) => acc || !!def.getColumnsDiff();
800-
let forced = false;
801794

802795
// Force re-render data rows if the list of column definitions have changed.
803796
if (this._rowDefs.reduce(columnsDiffReducer, false)) {
804797
this._forceRenderDataRows();
805-
forced = true;
806798
}
807799

808800
// Force re-render header/footer rows if the list of column definitions have changed..
809801
if (this._headerRowDefs.reduce(columnsDiffReducer, false)) {
810802
this._forceRenderHeaderRows();
811-
forced = true;
812803
}
813804

814805
if (this._footerRowDefs.reduce(columnsDiffReducer, false)) {
815806
this._forceRenderFooterRows();
816-
forced = true;
817-
}
818-
819-
if (forced) {
820-
this.updateStickyColumnStyles();
821807
}
822808
}
823809

@@ -888,6 +874,7 @@ export class CdkTable<T> implements AfterContentChecked, CollectionViewer, OnDes
888874

889875
this._headerRowDefs.forEach((def, i) => this._renderRow(this._headerRowOutlet, def, i));
890876
this.updateStickyHeaderRowStyles();
877+
this.updateStickyColumnStyles();
891878
}
892879
/**
893880
* Clears any existing content in the footer row outlet and creates a new embedded view
@@ -901,6 +888,7 @@ export class CdkTable<T> implements AfterContentChecked, CollectionViewer, OnDes
901888

902889
this._footerRowDefs.forEach((def, i) => this._renderRow(this._footerRowOutlet, def, i));
903890
this.updateStickyFooterRowStyles();
891+
this.updateStickyColumnStyles();
904892
}
905893

906894
/** Adds the sticky column styles for the rows according to the columns' stick states. */
@@ -1060,6 +1048,7 @@ export class CdkTable<T> implements AfterContentChecked, CollectionViewer, OnDes
10601048
this._dataDiffer.diff([]);
10611049
this._rowOutlet.viewContainer.clear();
10621050
this.renderRows();
1051+
this.updateStickyColumnStyles();
10631052
}
10641053

10651054
/**

0 commit comments

Comments
 (0)