@plcmp/pl-virtual-scroll 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plcmp/pl-virtual-scroll",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Component for lazy list render.",
5
5
  "main": "pl-virtual-scroll.js",
6
6
  "repository": {
@@ -211,6 +211,7 @@ class PlVirtualScroll extends PlElement {
211
211
  : 32; // TODO: replace w/o constant
212
212
  const predictedStart = Math.min(Math.ceil(this.canvas.parentNode.scrollTop / heightForStart), this.items.length - 1);
213
213
  firstShadow = lastShadow = this.renderItem(predictedStart, unused.pop(), this.canvas.parentNode.scrollTop);
214
+ used.unshift(firstShadow);
214
215
  }
215
216
  }
216
217
 
@@ -251,6 +252,9 @@ class PlVirtualScroll extends PlElement {
251
252
 
252
253
  if (Math.abs(predictedHeight - currentHeight) > restRows / 10 * avgHeight) {
253
254
  canvas.style.setProperty('height', predictedHeight + 'px');
255
+ if (predictedHeight - currentHeight > avgHeight) {
256
+ setTimeout(() => this.render(), 0);
257
+ }
254
258
  }
255
259
  }
256
260