Ionic v2 nightly-build: Loading => Promise exception
Ionic2 version: 2.0.0-rc.3-201612100458
Following code taken from my app:
navigateToDetail() {
let loading = this.loadingController.create({
dismissOnPageChange: true
});
loading.present().then(() => {
this.navController.push(DetailsPage, {
stuff: this.stuff
});
});
}
will produce following errors the very first time the page is pushed:
error_handler.js:53 Error: Uncaught (in promise): false
at s (polyfills.js:3)
at s (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (ng_zone.js:227)
at t.invokeTask (polyfills.js:3)
at e.runTask (polyfills.js:3)
at i (polyfills.js:3)
at HTMLElement.invoke (polyfills.js:3)
Tried the same above code in other places in my app, also tried to used var self=this didn't change it, nothing helped. Same code with official RC.3 doesn't produce any errors.
P.S.: Everything is compiling fine. Angular is up-to-date 2.2.1. Node_modules was deleted and installed again.
P.P.S.: Just tried to remove the "dismissOnPageChange: true" part. Of course the loading stay pending but except that everything went fine, new page is pushed, no error in the stacktrace
@peterpeterparker it would be helpfull if you provide an ionic info output. I'm pretty sure I do use also navcontroller in a loader. But I'll double check it later.
here you go:
Your system information:
Cordova CLI: 6.3.1 Ionic Framework Version: 2.0.0-rc.3-201612100458 Ionic CLI Version: 2.1.12 Ionic App Lib Version: 2.1.7 Ionic App Scripts Version: 0.0.46 ios-deploy version: 1.8.6 ios-sim version: 5.0.8 OS: macOS Sierra Node Version: v7.0.0 Xcode version: Xcode 8.0 Build version 8A218a
@ataraxus were you able to reproduce this ugly problem with the nightly-build?
no issues on my side:
open(page) {
let gotoPage;
switch (page) {
case 'quiz':
gotoPage = QuizStartPage;
break;
case 'cards':
gotoPage = CardsStartPage;
break;
case 'glossary':
gotoPage = GlossaryPage;
break;
case 'highscore':
gotoPage = HighScorePage;
break;
default: return;
}
let loader = this.loadingCtrl.create({
content: 'Bitte warten...',
dismissOnPageChange : true
});
loader.present().then(() => {
this.navCtrl.push(gotoPage);
});
}
Your system information:
ordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-rc.3-201612062256
Ionic CLI Version: 2.1.13
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.46
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 7
Node Version: v6.9.1
Xcode version: Not installed
Crazy. Same code here. Then I thought maybe the problem comes from my node version, I tried then with node 7.0.0, 7.2.1 and 6.9.1...nope, always face the error.
But I just notice, @ataraxus, won't you mind trying with the very last nightly-build? I just noticed mine is more recent...also could you display me your package.json, maybe I forgot something?
Really appreciate your help on that
I could reproduce the problem with the starter app using the nightly build by just adding a super simple load controller + push page. I just put the code on GitHub.
https://github.com/peterpeterparker/testLoadPush.git
@jgw96 or ionic team, won't you mind having a look before releasing RC.4 ... it's so less code I really don't know what I miss or what's wrong with my configuration...but if I'm not wrong, that could be a good quality check on the RC.4
Ionic info:
Your system information:
Cordova CLI: 6.3.1 Ionic Framework Version: 2.0.0-rc.3-201612122136 Ionic CLI Version: 2.1.12 Ionic App Lib Version: 2.1.7 Ionic App Scripts Version: 0.0.45 ios-deploy version: 1.8.6 ios-sim version: 5.0.8 OS: macOS Sierra Node Version: v6.9.1 Xcode version: Xcode 8.0 Build version 8A218a
Chrome up-to-date
With node 6.9.1 same problem
I stumbled upon this too so I did some digging, and the problem seems to be with dismissing a LoadingController when the dismissOnPageChange option is set to true. ~~This is independent of NavController,~~ any way of dismissing the LoadingController will trigger the exception. For example, a simple way to reproduce:
this.loading = this.loadingCtrl.create({dismissOnPageChange: true});
this.loading.present().then(() => this.loading.dismiss());
Edit: dismissing a LoadingController that has the dismissOnPageChange option is triggering a App.viewDidLeave which in turn triggers the routine to dismiss any views that have the dismissOnPageChange option, including the one that was just dismissed.
There should be a check here to make sure the view hasn't already been dismissed, but I don't see any relevant property in ViewController.
@jsayol thx for digging and adding your informations, so happy to hear that I'm not the only one facing that problem ;) I edited the title of the issue to make it more general.
Ok, got it. Adding a .catch() when dismissing prevents the unhandled exception. The fix is easy, just change the line here to this:
view.dismiss().catch(() => {});
I'll create the PR.
Thank you for the issue and all of the debugging! We've merged a fix for this and I've released a nightly with it:
npm install --save [email protected]
Please try it out and let me know if you find any issues. :smile:
2.0.0-rc.4-201612211600 fix that problem, thx for the fix!
For the record, while testing the nightly, I noticed following new problem which breaks my app. Rolling back to RC.4 official here.
https://github.com/driftyco/ionic/issues/9751
Hello @brandyscarney. I'm still having this issue using the latest nightly (2.0.0-rc.4-201612220408). You can take a look at this plnkr.
http://plnkr.co/edit/Ug1WQiOcFUbrSb2UlVFH?p=preview
Steps to reproduce:
- Click on Login
- A loader is displayed
- The app navigates to HomePage
- The error "Error: Uncaught (in promise): false" is logged to the console.
@jabas06 You don't need to .dismiss() the loader since you already set the dismissOnPageChange option. If you skip dismissing before setRoot() then everything works smoothly.
It does feel like an error though since I'm sure many users will have very similar code on their apps. That exception should not be thrown.
@jabas06 Could you create a separate issue for this with the same information and tag me in it please? :smile:
am getting the same error but for just setting the rootPage !!
the code in the app.component.ts
af.auth.subscribe( user => { if (user) { this.rootPage = ContactPage; } else { this.rootPage = LoginPage; } });
its just angularFire auth check, and as soon as the ContactPage is Showen, i receive the following Error
Runtime Error Uncaught (in promise): false Stack Error: Uncaught (in promise): false at s (http://localhost:8100/build/polyfills.js:3:4211) at s (http://localhost:8100/build/polyfills.js:3:4034) at http://localhost:8100/build/polyfills.js:3:4574 at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9723) at Object.onInvokeTask (http://localhost:8100/build/main.js:35478:37) at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9659) at e.runTask (http://localhost:8100/build/polyfills.js:3:7083) at i (http://localhost:8100/build/polyfills.js:3:3671) at HTMLElement.invoke (http://localhost:8100/build/polyfills.js:3:10876) Ionic Framework: ^2.0.0-rc.4 Ionic Native: 2.2.11 Ionic App Scripts: 0.0.48 Angular Core: 2.2.1 Angular Compiler CLI: 2.2.1 Node: 6.9.2 OS Platform: Windows 8.1 Navigator Platform: Win32 User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
Seems I got somewhat the same problem. It comes from just poping and then pushing to another page without passing any info. It works fine if I just push though without the pop. Just went back to rc 2 and it works perfectly.
Error: Uncaught (in promise): false at s (http://localhost:8100/build/polyfills.js:3:4211) at http://localhost:8100/build/polyfills.js:3:3961 at Object.ti.reject (http://localhost:8100/build/main.js:28161:23) at NavControllerBase._postViewInit (http://localhost:8100/build/main.js:28309:16) at NavControllerBase._viewTest (http://localhost:8100/build/main.js:28446:25) at NavControllerBase._nextTrns (http://localhost:8100/build/main.js:28218:25) at NavControllerBase._queueTrns (http://localhost:8100/build/main.js:28182:14) at NavControllerBase.pop (http://localhost:8100/build/main.js:28047:21) at LoginPage.pushPageToMap (http://localhost:8100/build/main.js:56013:22) at CompiledTemplate.proxyViewClass.View_LoginPage0.handleEvent_26 (/AppModule/LoginPage/component.ngfactory.js:308:34)
Ionic Framework: 2.0.0-rc.4-201612211600 Ionic Native: 2.2.11 Ionic App Scripts: 0.0.47 Angular Core: 2.2.1 Angular Compiler CLI: 2.2.1 Node: 6.9.2 OS Platform: Windows 10 Navigator Platform: Win32 User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
Can you please test using the latest nightly and if it's still an issue please provide a repository or plunker that we can use to reproduce?
@brandyscarney I tested that issue with the last nightly 2.0.0-rc.4-201701062325 and I could confirm, that at least in my case, it works like a charm. Thx a lot.
While testing this in debug mode and on a real phone I noticed a minor issue #9907 (which has a workaround). Don't know if it's a side effect of that task or not.
Tried with the 2.0.0-rc.4-201701062325 build still getting the same error. I've tried to make a new blank test project but still get the same error. Btw where can I see the new builds when they come out? Still pretty green. The blank debug repository is here: https://github.com/IngvarOlsen/ionicAppDebug
Edit: I've tried to run it with Node: 7.4.0, still the same error : / Another edit: So seems like what I was actually looking for was setRoot(), which works fine in the latest nightly.
I am also receiving the same error with similar code and the nightly 2.0.0-rc.4-201701062325 build.
firebase.auth().onAuthStateChanged((user) => {
this.zone.run( () => {
if (!user) {
this.rootPage = LoginPage;
} else {
this.rootPage = HomePage;
}
});
});
Runtime Error Uncaught (in promise): false Stack Error: Uncaught (in promise): false at s (http://localhost:8100/build/polyfills.js:3:4211) at s (http://localhost:8100/build/polyfills.js:3:4034) at http://localhost:8100/build/polyfills.js:3:4574 at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9723) at Object.onInvokeTask (http://localhost:8100/build/main.js:34839:37) at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9659) at e.runTask (http://localhost:8100/build/polyfills.js:3:7083) at i (http://localhost:8100/build/polyfills.js:3:3671) Ionic Framework: ^2.0.0-rc.4-201701062325 Ionic Native: 2.2.11 Ionic App Scripts: 1.0.0 Angular Core: 2.2.1 Angular Compiler CLI: 2.2.1 Node: 6.9.2 OS Platform: OS X El Capitan Navigator Platform: MacIntel User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36