0

I have an ion-refresher in 5 pages of my application

  <ion-refresher slot="fixed" (ionRefresh)="refreshActions($event)">
    <ion-refresher-content pulling-icon="null" refreshing-spinner="null">
      <ion-spinner name="crescent"></ion-spinner>
    </ion-refresher-content>
  </ion-refresher>

when im pulling down this refresh, it calls this method

  refreshActions($event) {
    this.subscription$.forEach(subscription => subscription.unsubscribe());
    this.loadFavoritesAssets(this.userId);
    setTimeout(() => {
      $event.target.complete();
    }, 500);
  }

this method unsubscribe from all subscriptions and reload the HTTP Request to call the new information in database, this works well

but when i navigate to another page, and try to call the other ion-refresher, the refresher doenst pull and doenst refresh the page, it gets stucks by the other page refresher.

then i need to get back to the previous page and scroll the screen or make some move to "complete" the refresh, after that i can refresh the other page.

Anyone knows what is this ? I dont undestand this behavior, it has something with the http request refresh method ? I'm calling the complete() method in the wrong way ?

And when i refresh the page and navigate to another page quickly, this behavior always happen

Gabriel Guedes
  • 481
  • 5
  • 15
  • We need to have more information to be able to provide you help. That said, here is one explaining that you have to be careful while changing the items appearing on your page. Can you have a look if you may to the same error? https://github.com/ionic-team/ionic-framework/issues/18580#issuecomment-507196598. And, I wouldn't do a loop to unsubscribe, but subscribe them to an observable and then complete them https://stackoverflow.com/a/42490431/11135174 – Raphaël Balet Oct 27 '20 at 13:36

1 Answers1

0

just remove this line from your above code and check

this.subscription$.forEach(subscription => subscription.unsubscribe());

Vicky Pal
  • 99
  • 1
  • 6