Use existing render function for initial render

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-08-09 15:04:17 +05:30 committed by Bruno Windels
parent a02b6b68d3
commit 587dd3848e

View file

@ -168,21 +168,10 @@ export class LazyListView extends ListView {
this._height = this._parent.clientHeight; this._height = this._parent.clientHeight;
if (this._height === 0) { console.error("LazyListView could not calculate parent height."); } if (this._height === 0) { console.error("LazyListView could not calculate parent height."); }
const range = this._getVisibleRange(); const initialRange = this._getVisibleRange();
const renderRange = range.expand(this._overflowItems); const initialRenderRange = initialRange.expand(this._overflowItems);
this._renderRange = renderRange; this._renderRange = new ItemRange(0, 0, 0);
this._renderElementsInRange(initialRenderRange);
const { topCount, renderCount } = this._renderRange;
const renderedItems = this._itemsFromList({ start: topCount, end: topCount + renderCount});
this._adjustPadding(renderRange);
this._childInstances = [];
const fragment = document.createDocumentFragment();
for (const item of renderedItems) {
const view = this._childCreator(item);
this._childInstances.push(view);
fragment.appendChild(mountView(view, this._mountArgs));
}
this._root.appendChild(fragment);
} }
_itemsFromList({start, end}) { _itemsFromList({start, end}) {