Skip to content

Commit c97e6af

Browse files
authored
refactor: avoid layout thrashing on first dropdown render (#10382)
1 parent 450b464 commit c97e6af

File tree

5 files changed

+2
-2
lines changed

5 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
@@ -329,7 +329,7 @@ export class InfiniteScroller extends HTMLElement {
329329

330330
/** @private */
331331
_createPool() {
332-
const container = this.getBoundingClientRect();
332+
const viewportHeight = this.innerHeight;
333333
this._buffers.forEach((buffer) => {
334334
for (let i = 0; i < this.bufferSize; i++) {
335335
const itemWrapper = document.createElement('div');
@@ -347,7 +347,7 @@ export class InfiniteScroller extends HTMLElement {
347347
this.appendChild(itemWrapper);
348348

349349
// Only stamp the visible instances first
350-
if (this._isVisible(itemWrapper, container)) {
350+
if (this.itemHeight * i <= viewportHeight) {
351351
this._ensureStampedInstance(itemWrapper);
352352
}
353353
}
-365 Bytes
Loading
-527 Bytes
Loading
-319 Bytes
Loading
-281 Bytes
Loading

0 commit comments

Comments
 (0)