From 587dd3848e6517fb04c9eadcb091aaea3e275f53 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Mon, 9 Aug 2021 15:04:17 +0530 Subject: [PATCH] Use existing render function for initial render Signed-off-by: RMidhunSuresh --- src/platform/web/ui/general/LazyListView.js | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/platform/web/ui/general/LazyListView.js b/src/platform/web/ui/general/LazyListView.js index f0de677c..aa38a4fb 100644 --- a/src/platform/web/ui/general/LazyListView.js +++ b/src/platform/web/ui/general/LazyListView.js @@ -168,21 +168,10 @@ export class LazyListView extends ListView { this._height = this._parent.clientHeight; if (this._height === 0) { console.error("LazyListView could not calculate parent height."); } - const range = this._getVisibleRange(); - const renderRange = range.expand(this._overflowItems); - this._renderRange = renderRange; - - 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); + const initialRange = this._getVisibleRange(); + const initialRenderRange = initialRange.expand(this._overflowItems); + this._renderRange = new ItemRange(0, 0, 0); + this._renderElementsInRange(initialRenderRange); } _itemsFromList({start, end}) {