Skip to content

Commit 7065a37

Browse files
authored
refactor: avoid layout thrashing on first dropdown render (#10380)
1 parent 410b3c5 commit 7065a37

File tree

7 files changed

+2
-2
lines changed

7 files changed

+2
-2
lines changed

packages/date-picker/src/vaadin-infinite-scroller.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ export class InfiniteScroller extends HTMLElement {
308308

309309
/** @private */
310310
_createPool() {
311-
const container = this.getBoundingClientRect();
311+
const viewportHeight = this.innerHeight;
312312
this._buffers.forEach((buffer) => {
313313
for (let i = 0; i < this.bufferSize; i++) {
314314
const itemWrapper = document.createElement('div');
@@ -326,7 +326,7 @@ export class InfiniteScroller extends HTMLElement {
326326
this.appendChild(itemWrapper);
327327

328328
// Only stamp the visible instances first
329-
if (this._isVisible(itemWrapper, container)) {
329+
if (this.itemHeight * i <= viewportHeight) {
330330
this._ensureStampedInstance(itemWrapper);
331331
}
332332
}
-275 Bytes
Loading
-611 Bytes
Loading
-527 Bytes
Loading
-168 Bytes
Loading
-345 Bytes
Loading
-293 Bytes
Loading

0 commit comments

Comments
 (0)