From 4ca4abf3f4f744ce5e4b32a9d63cdca1a8c1571d Mon Sep 17 00:00:00 2001 From: nename0 Date: Wed, 22 Aug 2018 11:18:23 +0200 Subject: [PATCH] pref(table): prevent unnecessary reflow with sticky row The offset of a sticky row is calculated by summing up the heights of the previous sticky rows. As the access to the height causes a forced reflow this is now skipped when there is only one row. --- src/cdk/table/sticky-styler.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cdk/table/sticky-styler.ts b/src/cdk/table/sticky-styler.ts index 10edad73e593..8a33a044e87b 100644 --- a/src/cdk/table/sticky-styler.ts +++ b/src/cdk/table/sticky-styler.ts @@ -133,6 +133,10 @@ export class StickyStyler { this._addStickyStyle(row, position, stickyHeight); } + if (rowIndex === rows.length - 1) { + // prevent unnecessary reflow from getBoundingClientRect() + return; + } stickyHeight += row.getBoundingClientRect().height; } }