@vaadin/vaadin-combo-box
Advanced tools
Comparing version 5.4.1 to 5.4.2
@@ -13,3 +13,3 @@ { | ||
"name": "@vaadin/vaadin-combo-box", | ||
"version": "5.4.1", | ||
"version": "5.4.2", | ||
"main": "vaadin-combo-box.js", | ||
@@ -16,0 +16,0 @@ "author": "Vaadin Ltd", |
@@ -212,2 +212,6 @@ /** | ||
this.filteredItems = filteredItems; | ||
// Cleans up the redundant pending requests for pages > size | ||
// Refers to https://github.com/vaadin/vaadin-flow-components/issues/229 | ||
this._flushPendingRequests(size); | ||
} | ||
@@ -259,2 +263,28 @@ | ||
/** | ||
* This method cleans up the page callbacks which refers to the | ||
* non-existing pages, i.e. which item indexes are greater than the | ||
* changed size. | ||
* This case is basically happens when: | ||
* 1. Users scroll fast to the bottom and combo box generates the | ||
* redundant page request/callback | ||
* 2. Server side uses undefined size lazy loading and suddenly reaches | ||
* the exact size which is on the range edge | ||
* (for default page size = 50, it will be 100, 200, 300, ...). | ||
* @param size the new size of items | ||
* @private | ||
*/ | ||
_flushPendingRequests(size) { | ||
if (this._pendingRequests) { | ||
const lastPage = Math.ceil(size / this.pageSize); | ||
const pendingRequestsKeys = Object.keys(this._pendingRequests); | ||
for (let reqIdx = 0; reqIdx < pendingRequestsKeys.length; reqIdx++) { | ||
const page = parseInt(pendingRequestsKeys[reqIdx]); | ||
if (page >= lastPage) { | ||
this._pendingRequests[page]([], size); | ||
} | ||
} | ||
} | ||
} | ||
}; |
@@ -232,3 +232,3 @@ /** | ||
static get version() { | ||
return '5.4.1'; | ||
return '5.4.2'; | ||
} | ||
@@ -235,0 +235,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
143498
3659