Skip to content

Commit f9d5f09

Browse files
authored
refactor: avoid forced style recalculation on scroll (#10150)
1 parent af483b5 commit f9d5f09

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

packages/component-base/src/virtualizer-iron-list-adapter.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,8 @@ export class IronListAdapter {
547547
return;
548548
}
549549

550-
this._adjustVirtualIndexOffset(this._scrollTop - (this.__previousScrollTop || 0));
551-
const delta = this.scrollTarget.scrollTop - this._scrollPosition;
550+
this._adjustVirtualIndexOffset(this._scrollTop - this._scrollPosition);
551+
const delta = this._scrollTop - this._scrollPosition;
552552

553553
super._scrollHandler();
554554

@@ -601,11 +601,9 @@ export class IronListAdapter {
601601
);
602602
}
603603

604-
this.__previousScrollTop = this._scrollTop;
605-
606604
// If the first visible index is not 0 when scrolled to the top,
607605
// scroll to index 0 to fix the issue.
608-
if (this._scrollTop === 0 && this.firstVisibleIndex !== 0 && Math.abs(delta) > 0) {
606+
if (this._scrollPosition === 0 && this.firstVisibleIndex !== 0 && Math.abs(delta) > 0) {
609607
this.scrollToIndex(0);
610608
}
611609
}

0 commit comments

Comments
 (0)