@@ -23,7 +23,6 @@ export abstract class ResizeStrategy implements OnDestroy {
23
23
protected abstract readonly styleScheduler : _CoalescedStyleScheduler ;
24
24
protected abstract readonly table : CdkTable < unknown > ;
25
25
26
- private _pendingResizeDelta : number | null = null ;
27
26
private _tableObserved = false ;
28
27
private _elemSizeCache = new WeakMap < HTMLElement , { width : number ; height : number } > ( ) ;
29
28
private _resizeObserver = globalThis ?. ResizeObserver
@@ -54,27 +53,15 @@ export abstract class ResizeStrategy implements OnDestroy {
54
53
55
54
/** Adjusts the width of the table element by the specified delta. */
56
55
protected updateTableWidthAndStickyColumns ( delta : number ) : void {
57
- if ( this . _pendingResizeDelta === null ) {
58
- const tableElement = this . columnResize . elementRef . nativeElement ;
59
- const tableWidth = this . getElementWidth ( tableElement ) ;
56
+ this . columnResize . _flushPending = true ;
60
57
61
- this . styleScheduler . schedule ( ( ) => {
62
- tableElement . style . width = coerceCssPixelValue ( tableWidth + this . _pendingResizeDelta ! ) ;
63
-
64
- this . _pendingResizeDelta = null ;
65
- } ) ;
66
-
67
- this . styleScheduler . scheduleEnd ( ( ) => {
68
- // Once the column sizes have updated, we unset the table width so that
69
- // it does not have unwanted side effects on future changes in the table
70
- // such as columns being added or removed.
71
- tableElement . style . width = '' ;
72
-
73
- this . table . updateStickyColumnStyles ( ) ;
74
- } ) ;
75
- }
76
-
77
- this . _pendingResizeDelta = ( this . _pendingResizeDelta ?? 0 ) + delta ;
58
+ this . styleScheduler . scheduleEnd ( ( ) => {
59
+ if ( ! this . columnResize . _flushPending ) {
60
+ return ;
61
+ }
62
+ this . columnResize . _flushPending = false ;
63
+ this . table . updateStickyColumnStyles ( ) ;
64
+ } ) ;
78
65
}
79
66
80
67
/** Gets the style.width pixels on the specified element if present, otherwise its offsetWidth. */
0 commit comments