Ionic version: 4.1.0
ion-refresher fired multiple times when I use ion-list with ngFor
<ion-content>
<ion-refresher slot="fixed" (ionRefresh)="getItems($event)">
<ion-refresher-content
pullingIcon="arrow-down"
pullingText="Pull to refresh"
refreshingSpinner="circles"
refreshingText="Refreshing...">
</ion-refresher-content>
</ion-refresher>
<ion-list no-padding *ngFor="let item of items">
<ion-item>
{{item.name}}
</ion-item>
</ion-list>
</ion-content>
Same error in documentation
I click on the top, pull down -> ion-refresher fired
Move to bottom click and move to the top -> refresher fired again.
Move mouse cursor (without click) -> refresher fired multiple times
Same problem here. With Chrome, I selected iPhone/iPad simulation and I could reproduce the bug.
Thanks for the additional info everyone! I was able to reproduce this issue. We will look into this!
Temporary solution:
Maybe It can help…
I think, in my case was this and worked… the problem is when
items
is set to an empty Array to be refilled, this will empty the list and the scroll will resize to 0… then, when we add items toitems
list, all will rebuild but a race condition will occur and the refresher will get scroll when it’s 0 or no scroll is shown and will act in consequence and fire again.The solution I used after researching a bit … is don’t clear
items
, just create a newArray
and fill it… and finally replaceitems
with new array.This worked for me, hope it helps!