Skip to content

Commit 2892f7e

Browse files
committed
perf: Implement atomic Grid Body updates via explicit suspension flag (#8989)
1 parent 75c6c19 commit 2892f7e

2 files changed

Lines changed: 39 additions & 19 deletions

File tree

src/grid/Body.mjs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,6 @@ class GridBody extends Container {
347347
value > 0 && this.updateMountedAndVisibleColumns()
348348
}
349349

350-
351-
352350
/**
353351
* Triggered after the isScrolling config got changed
354352
* @param {Number} value
@@ -566,8 +564,13 @@ class GridBody extends Container {
566564
* @param {Boolean} silent=false True to suppress the final VDOM update (used when batching).
567565
*/
568566
createViewData(silent=false) {
569-
let me = this,
570-
{mountedRows, store} = me,
567+
let me = this;
568+
569+
if (me.skipCreateViewData) {
570+
return
571+
}
572+
573+
let {mountedRows, store} = me,
571574
endIndex, i, item, itemIndex, poolSize, range;
572575

573576
if (

src/grid/ScrollManager.mjs

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ class ScrollManager extends Base {
1111
* @static
1212
*/
1313
static delayable = {
14-
onBodyScroll : {type: 'throttle', timer: 16},
14+
// onBodyScroll : {type: 'throttle', timer: 10},
1515
onBodyScrollEnd : {type: 'buffer', timer: 150},
16-
onContainerScroll: {type: 'throttle', timer: 16}
16+
// onContainerScroll: {type: 'throttle', timer: 16},
17+
syncGridBody : {type: 'throttle', timer: 10}
1718
}
1819

1920
static config = {
@@ -94,14 +95,13 @@ class ScrollManager extends Base {
9495
* @protected
9596
*/
9697
onBodyScroll({scrollTop}) {
97-
let me = this,
98-
body = me.gridBody;
99-
100-
me.scrollTop = scrollTop;
98+
let me = this;
10199

102-
body.set({isScrolling: true, scrollTop});
100+
me.scrollTop = scrollTop;
101+
me.gridBody.isScrolling = true;
103102

104-
me.onBodyScrollEnd()
103+
me.onBodyScrollEnd();
104+
me.syncGridBody()
105105
}
106106

107107
/**
@@ -117,19 +117,36 @@ class ScrollManager extends Base {
117117
* @param {Object} data.target
118118
*/
119119
onContainerScroll({scrollLeft, target}) {
120-
let me = this,
121-
body = me.gridBody;
120+
let me = this;
122121

123122
// We must ignore events for grid-scrollbar
124123
if (target.id.includes('grid-container')) {
125-
body.isScrolling = true;
124+
me.scrollLeft = scrollLeft;
125+
me.gridBody.isScrolling = true;
126+
126127
me.onBodyScrollEnd();
128+
me.syncGridBody()
129+
}
130+
}
127131

128-
me .scrollLeft = scrollLeft;
129-
body.scrollLeft = scrollLeft;
132+
/**
133+
* @protected
134+
*/
135+
syncGridBody() {
136+
let me = this,
137+
body = me.gridBody;
130138

131-
me.gridContainer.headerToolbar.scrollLeft = scrollLeft
132-
}
139+
body.skipCreateViewData = true;
140+
141+
body.set({
142+
scrollLeft: me.scrollLeft,
143+
scrollTop : me.scrollTop
144+
});
145+
146+
body.skipCreateViewData = false;
147+
body.createViewData();
148+
149+
me.gridContainer.headerToolbar.scrollLeft = me.scrollLeft
133150
}
134151

135152
/**

0 commit comments

Comments
 (0)