diff --git a/src/app/components/scroller/scroller.ts b/src/app/components/scroller/scroller.ts index f7958572c59..badf143895b 100644 --- a/src/app/components/scroller/scroller.ts +++ b/src/app/components/scroller/scroller.ts @@ -307,29 +307,26 @@ export class Scroller implements OnInit, AfterContentInit, AfterViewChecked, OnD } ngOnChanges(simpleChanges: SimpleChanges) { - if (this.initialized) { - let areItemsChanged = false; - if (simpleChanges.items) { - const { previousValue: prevItems, currentValue: currentItems } = simpleChanges.items; - areItemsChanged = !prevItems || prevItems.length !== (currentItems || []).length; - } - - const isChanged = (areItemsChanged || simpleChanges.itemSize || simpleChanges.scrollHeight || simpleChanges.scrollWidth); - isChanged && this.init(); - } - - if (simpleChanges.orientation) { - this.lastScrollPos = this.both ? { top: 0, left: 0 } : 0; - } + let isLoadingChanged = false; if (simpleChanges.loading) { const { previousValue, currentValue } = simpleChanges.loading; if (this.lazy && previousValue !== currentValue && currentValue !== this.d_loading) { this.d_loading = currentValue; + isLoadingChanged = true; } } + if (this.initialized) { + const isChanged = !isLoadingChanged && (simpleChanges.items || simpleChanges.itemSize || simpleChanges.scrollHeight || simpleChanges.scrollWidth); + isChanged && this.init(); + } + + if (simpleChanges.orientation) { + this.lastScrollPos = this.both ? { top: 0, left: 0 } : 0; + } + if (simpleChanges.numToleratedItems) { const { previousValue, currentValue } = simpleChanges.numToleratedItems;