Skip to content

Commit

Permalink
refactor: drop obsolete scroller workaround (#7257)
Browse files Browse the repository at this point in the history
  • Loading branch information
vursen authored Mar 22, 2024
1 parent 7d675c6 commit 5b41105
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
20 changes: 0 additions & 20 deletions packages/combo-box/src/vaadin-combo-box-data-provider-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,6 @@ export const ComboBoxDataProviderMixin = (superClass) =>
super.ready();
this._scroller.addEventListener('index-requested', (e) => {
const index = e.detail.index;
const currentScrollerPos = e.detail.currentScrollerPos;
const allowedIndexRange = Math.floor(this.pageSize * 1.5);

// Ignores the indexes, which are being re-sent during scrolling reset,
// if the corresponding page is around the current scroller position.
// Otherwise, there might be a last pages duplicates, which cause the
// loading indicator hanging and blank items
if (this._shouldSkipIndex(index, allowedIndexRange, currentScrollerPos)) {
return;
}

if (index !== undefined) {
const page = this._getPageForIndex(index);
if (this._shouldLoadPage(page)) {
Expand Down Expand Up @@ -141,15 +130,6 @@ export const ComboBoxDataProviderMixin = (superClass) =>
}
}

/** @private */
_shouldSkipIndex(index, allowedIndexRange, currentScrollerPos) {
return (
currentScrollerPos !== 0 &&
index >= currentScrollerPos - allowedIndexRange &&
index <= currentScrollerPos + allowedIndexRange
);
}

/** @private */
_shouldLoadPage(page) {
if (!this.filteredItems || this._forceNextRequest) {
Expand Down
1 change: 0 additions & 1 deletion packages/combo-box/src/vaadin-combo-box-scroller-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,6 @@ export const ComboBoxScrollerMixin = (superClass) =>
new CustomEvent('index-requested', {
detail: {
index,
currentScrollerPos: this._oldScrollerPosition,
},
}),
);
Expand Down

0 comments on commit 5b41105

Please sign in to comment.