Skip to content

Commit 843dbab

Browse files
authored
refactor: calculate grid overflow in debouncer callback (#5406)
1 parent a852ac3 commit 843dbab

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

‎packages/grid/src/vaadin-grid-scroll-mixin.js‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,13 @@ export const ScrollMixin = (superClass) =>
147147

148148
/** @private */
149149
_updateOverflow() {
150+
this._debounceOverflow = Debouncer.debounce(this._debounceOverflow, animationFrame, () => {
151+
this.__doUpdateOverflow();
152+
});
153+
}
154+
155+
/** @private */
156+
__doUpdateOverflow() {
150157
// Set overflow styling attributes
151158
let overflow = '';
152159
const table = this.$.table;
@@ -182,14 +189,12 @@ export const ScrollMixin = (superClass) =>
182189
overflow += ' left';
183190
}
184191

185-
this._debounceOverflow = Debouncer.debounce(this._debounceOverflow, animationFrame, () => {
186-
const value = overflow.trim();
187-
if (value.length > 0 && this.getAttribute('overflow') !== value) {
188-
this.setAttribute('overflow', value);
189-
} else if (value.length === 0 && this.hasAttribute('overflow')) {
190-
this.removeAttribute('overflow');
191-
}
192-
});
192+
const value = overflow.trim();
193+
if (value.length > 0 && this.getAttribute('overflow') !== value) {
194+
this.setAttribute('overflow', value);
195+
} else if (value.length === 0 && this.hasAttribute('overflow')) {
196+
this.removeAttribute('overflow');
197+
}
193198
}
194199

195200
/** @protected */

0 commit comments

Comments
 (0)