Stacked alerts not dismissing after 3.5.0

Opening an alert immediately after an alert closes causes the previous to not dismiss.
The result is, the alerts seem to to Stack.

Prior to 3.5.0 the following was working:

alertOne() {
    let alert = this.alertCtrl.create({
      title: "Alert One",
      subTitle: 'Okay should open the second alert',
      buttons: [
        {
          text: 'Cancel',
          role: 'cancel',
          handler: data => {
            console.log('No clicked');
          }
        }, {
          text: 'Okay',
          handler: data => {
            this.alertTwo();
          }
        },
      ]
    });
    alert.present();
  }

  alertTwo() {
    let alert = this.alertCtrl.create({
      title: "Alert Two",
      subTitle: 'Okay should open the third alert',
      buttons: [
        {
          text: 'Cancel',
          role: 'cancel',
          handler: data => {
            console.log('No clicked');
          }
        }, {
          text: 'Okay',
          handler: data => {
            this.alertThree();
          }
        },
      ]
    });
    alert.present();
  }

alertThree() {
    let alert = this.alertCtrl.create({
      title: "Alert Three",
      subTitle: 'Okay should open the first alert',
      buttons: [
        {
          text: 'Cancel',
          role: 'cancel',
          handler: data => {
            console.log('No clicked');
          }
        }, {
          text: 'Okay',
          handler: data => {
            this.alertOne();//will loop
          }
        },
      ]
    });
    alert.present();
  }

A temporary solution is to put a setTimeout on the handler: ( yaya - I know )

setTimeout(() => {
      this.alertThree();
    }, 100);

If this is new and unwanted behaviour: https://github.com/ionic-team/ionic/issues

I will wait and see if anyone else experiences this and has an alternative solution. Or if I was just plain doing something wrong from the get-go.

2 Likes

This is also happening to me. I want to display a Alert when clicking a “About” button. This work fine but when I leave the current page and then come back I get a stack of 2 alerts and so on… How did you solved it?