Skip to content

Commit 1e4ee0c

Browse files
josephperrottvivian-hu-zz
authored andcommitted
feat(tabs): make the updatePagination method public (#13935)
1 parent f6bfcff commit 1e4ee0c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/lib/tabs/tab-header.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export class MatTabHeader extends _MatTabHeaderMixinBase
147147
ngAfterContentChecked(): void {
148148
// If the number of tab labels have changed, check if scrolling should be enabled
149149
if (this._tabLabelCount != this._labelWrappers.length) {
150-
this._updatePagination();
150+
this.updatePagination();
151151
this._tabLabelCount = this._labelWrappers.length;
152152
this._changeDetectorRef.markForCheck();
153153
}
@@ -198,7 +198,7 @@ export class MatTabHeader extends _MatTabHeaderMixinBase
198198
const dirChange = this._dir ? this._dir.change : observableOf(null);
199199
const resize = this._viewportRuler.change(150);
200200
const realign = () => {
201-
this._updatePagination();
201+
this.updatePagination();
202202
this._alignInkBarToSelectedTab();
203203
};
204204

@@ -238,7 +238,7 @@ export class MatTabHeader extends _MatTabHeaderMixinBase
238238
*/
239239
_onContentChanges() {
240240
const zoneCallback = () => {
241-
this._updatePagination();
241+
this.updatePagination();
242242
this._alignInkBarToSelectedTab();
243243
this._changeDetectorRef.markForCheck();
244244
};
@@ -250,9 +250,13 @@ export class MatTabHeader extends _MatTabHeaderMixinBase
250250
}
251251

252252
/**
253-
* Updating the view whether pagination should be enabled or not
253+
* Updates the view whether pagination should be enabled or not.
254+
*
255+
* WARNING: Calling this method can be very costly in terms of performance. It should be called
256+
* as infrequently as possible from outside of the Tabs component as it causes a reflow of the
257+
* page.
254258
*/
255-
_updatePagination() {
259+
updatePagination() {
256260
this._checkPaginationEnabled();
257261
this._checkScrollingControls();
258262
this._updateTabScrollPosition();

0 commit comments

Comments
 (0)