Ionic-framework: bug(loadingController): Dismiss throwing exception

Created on 7 Apr 2017  路  13Comments  路  Source: ionic-team/ionic-framework

Ionic version: (check one with "x")
[ ] 1.x
[ ] 2.x
[x] 3.x

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:
When calling dismiss() on a LoadingController, an exception is thrown from the framework.

image

Expected behavior:
Dismissing popups from the LoadingController should work correctly.

Related code:

  ionViewDidLoad() {
    let loader = this.loader.create({
      content: "Logging out...",
    });
    loader.onDidDismiss(() => {
      console.log('loader dismissed');
    });

    loader.present();

   // perform some quick action

    loader.dismiss();
  }

Other information:

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

Cordova CLI: 6.5.0
Ionic Framework Version: 3.0.1
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.0
ios-deploy version: 1.9.0
ios-sim version: 5.0.10
OS: macOS Sierra
Node Version: v6.9.5
Xcode version: Xcode 8.3.1 Build version 8E1000a
reply

Most helpful comment

I think it is because you can't dismiss something that was not shown.
Try:
loader.present().then(() => loader.dismiss())

All 13 comments

I think it is because you can't dismiss something that was not shown.
Try:
loader.present().then(() => loader.dismiss())

Hey @dylanvdmerwe , @AmitMY makes a good point here, its possible that your running into a race condition here where loader.dismiss() fires before present is done.

PS: Thanks for the input @AmitMY (:

Unfortunately, this is in fact a very serious bug and affects all the components using NavControllerBase.

https://github.com/driftyco/ionic/pull/11126#issuecomment-292666442

@manucorporat What's about this bug?

News about that?

@AmitMY yeah thx I saw this some days ago and I also asked to the team a status update about the bug with no response. I don't know how is the situation but I think this bug is really severe and I think this should have max priority or not?

Thanks for the lead guys, I found the same issue in my app.

Your system information:

Cordova CLI: 6.5.0
Ionic Framework Version: 3.0.1
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.3
ios-deploy version: 1.9.1
ios-sim version: 5.0.8
OS: macOS Sierra
Node Version: v7.7.4
Xcode version: Xcode 8.3.1 Build version 8E1000a

Temporary workaround-

        setTimeout(() => {
          this.loading.dismiss();
        }, 50);

@AmitMY I'm not sure how this could be a workaround for my issue. I can not do something like that

    ionViewCanEnter(): Promise<any> {
        //console.log('LoginPage#ionViewCanEnter');

        setTimeout(() => {
            return this.authGuard.canActivateLoginPage();
        }, 500);
    }

My problem is for sure the BavControllerBase and I think I have to wait until the team merged and released #11128

@philipbrack your Temporary workaround worked for me too. Thank you

Hello all! I am going to close this for now as it seems manu's PR to fix this issue was merged. Thanks!

Okay but which PR do you mean? Just for information?

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Was this page helpful?
0 / 5 - 0 ratings