From 33ac34b04e05eced0ffec18cf9f985e7e74d5e20 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Sun, 15 Aug 2021 20:48:51 +0530 Subject: [PATCH] Do not break onListChanged Signed-off-by: RMidhunSuresh --- src/platform/web/ui/general/LazyListView.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/platform/web/ui/general/LazyListView.js b/src/platform/web/ui/general/LazyListView.js index 6864172c..c064a2b5 100644 --- a/src/platform/web/ui/general/LazyListView.js +++ b/src/platform/web/ui/general/LazyListView.js @@ -162,6 +162,7 @@ export class LazyListView extends ListView { onAdd(idx, value) { const {topCount, renderCount, bottomCount} = this._renderRange; if (this._renderRange.containsIndex(idx)) { + this.onBeforeListChanged(); const normalizedIdx = this._renderRange.normalize(idx); if (bottomCount === 0) { /* @@ -179,7 +180,8 @@ export class LazyListView extends ListView { this._removeChild(this._childInstances.pop()); this._renderRange = new ItemRange(topCount, renderCount, bottomCount + 1); } - super.onAdd(normalizedIdx, value); + super.onAdd(normalizedIdx, value, true); + this.onListChanged(); } else { this._renderRange = idx < topCount ? new ItemRange(topCount + 1, renderCount, bottomCount): @@ -191,8 +193,9 @@ export class LazyListView extends ListView { onRemove(idx, value) { const {topCount, renderCount, bottomCount} = this._renderRange; if (this._renderRange.containsIndex(idx)) { + this.onBeforeListChanged(); const normalizedIdx = this._renderRange.normalize(idx); - super.onRemove(normalizedIdx, value); + super.onRemove(normalizedIdx, value, true); if (bottomCount === 0) { // See onAdd for explanation this._renderRange = new ItemRange(topCount, renderCount - 1, bottomCount); @@ -203,6 +206,7 @@ export class LazyListView extends ListView { this._root.appendChild(mountView(child, this._mountArgs)); this._renderRange = new ItemRange(topCount, renderCount, bottomCount - 1); } + this.onListChanged(); } else { this._renderRange = idx < topCount ? new ItemRange(topCount - 1, renderCount, bottomCount):