MOBILE-4470 infinite-loading: Fix consecutive loads not working

main
Dani Palou 2024-05-08 16:16:35 +02:00
parent ed22463b9c
commit efb8fdd630
2 changed files with 7 additions and 8 deletions

View File

@ -9,7 +9,8 @@
</div>
</ng-container>
<ion-infinite-scroll [disabled]="!enabled || error || loadingMore" (ionInfinite)="loadMore()" [position]="position">
<!-- Don't allow disabling infinite-scroll while loading more items, otherwise infinite scroll stops working. -->
<ion-infinite-scroll [disabled]="!loadingMore && (!enabled || error)" (ionInfinite)="loadMore()" [position]="position">
<ion-infinite-scroll-content />
</ion-infinite-scroll>

View File

@ -109,13 +109,11 @@ export class CoreInfiniteLoadingComponent implements OnChanges {
/**
* Complete loading.
*/
complete(): void {
if (this.position == 'top') {
// Wait a bit before allowing loading more, otherwise it could be re-triggered automatically when it shouldn't.
setTimeout(() => this.completeLoadMore(), 400);
} else {
this.completeLoadMore();
}
async complete(): Promise<void> {
// Wait a bit before allowing loading more, otherwise it could be re-triggered automatically when it shouldn't.
await CoreUtils.wait(400);
await this.completeLoadMore();
}
/**