-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ionic v2 nightly-build: Loading => Promise exception #9589
Comments
@peterpeterparker it would be helpfull if you provide an |
here you go: Your system information: Cordova CLI: 6.3.1 |
@ataraxus were you able to reproduce this ugly problem with the nightly-build? |
no issues on my side:
|
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 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 this.loading = this.loadingCtrl.create({dismissOnPageChange: true});
this.loading.present().then(() => this.loading.dismiss()); Edit: dismissing a 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 |
@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 view.dismiss().catch(() => {}); I'll create the PR. |
* fix(loading/toast): don't call to dismiss pages if the view is an overlay fixes #9589 * test(overlay): add tests for loading and toast with view events * test(datetime): add missing declaration
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:
Please try it out and let me know if you find any issues. 😄 |
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. |
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:
|
@jabas06 You don't need to 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? 😄 |
am getting the same error but for just setting the rootPage !! the code in the app.component.ts af.auth.subscribe( user => { its just angularFire auth check, and as soon as the ContactPage is Showen, i receive the following Error Runtime Error |
Seems I got somewhat the same problem. Error: Uncaught (in promise): false Ionic Framework: 2.0.0-rc.4-201612211600 |
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? |
@jgw96 - I am not using a loading component if you are referring to https://ionicframework.com/docs/v2/components/#loading. My app is a simple integration with firebase and authentication. |
@luciandarabus so just to be clear, you get this error only with the latest nightly right? On rc.4 you do not get the error? |
I get the error both with RC4 and with 2.0.0-rc.4-201701062325. |
Hey @luciandarabus thanks for all the info so far. Do you have a repo i can test this issue with? The repo you posted above is on RC.1. I cannot seem to reproduce this with my own app using Firebase and running on the latest nightly unfortunately. |
Hey @luciandarabus quick update on this. I am now able to repro with firebase but cannot repro in an app not using firebase. Can you confirm that you get the same behavior? |
Hey @jgw96. Yes, I am seeing the same behaviour. Once you add firebase and you have to login the error will show up. When you are already logged in and you do a refresh that will trigger the this.rootPage = HomePage in my code there is no error. Tried with rc5 and I get the same error at login. |
Hey people, I had been banging my head against my keyboard with this for a while, until one of my blog readers pointed something that made me take a look at the view changing process I was using (If you're reading this, I don't remember who you are so sorry for not giving you proper credit 😞). The issue seems to happen when Firebase is returning a Promise from the Login, Signup or LogOut methods, so I started to check those to see what was going on and on every single method I had a Inside that promise return I was sending the user to a different page. For example, after a user logged out, I'd send him to the LoginPage: firebase.auth().signOut().then( () => {
navCtrl.setRoot(LoginPage);
}); And in my head that was ok, the problem here comes from the It's already listening to the auth changes and setting the rootPage depending on whether there's a logged in user or not: firebase.auth().onAuthStateChanged((user) => {
this.zone.run( () => {
if (!user) {
this.rootPage = LoginPage;
} else {
this.rootPage = HomePage;
}
});
}); The thing there is that when my users log-out it's 1) trying to set the rootPage via the auth listener and 2) trying to return a promise that sets the rootPage also. That caused the Promise uncaught error in almost every case, especially when using other view components such as alerts and loading spinners. The easy solution to keep returning the promise after the function is to unsubscribe from the auth listener: const unsubscribe = firebase.auth().onAuthStateChanged((user) => {
this.zone.run( () => {
if (!user) {
this.rootPage = LoginPage;
unsubscribe();
} else {
this.rootPage = HomePage;
unsubscribe();
}
});
}); That way my code isn't breaking anymore, I handle the auth listening part when the user first loads the app and then it unsubscribes, so I handle the pushing or root setting in every promise I return. Another thing you could do is to leave the auth listener active and just don't push or setRoot after login, logout or signup. Please take a look and test yourselves, let me know if this also fixes it for you or if there are use-cases when it keeps happening. |
for AngularFire2:
|
what does 'zone' represents? |
I am facing issue : @import "ionic.ionicons"; |
The issue is back in Ionic 3.0.0... |
On Ionic 3.0.0 beta 3; this issue is definitely back. I'm unsure what triggers it exactly, but I've had the same code fail sometimes and then work other times. |
Can confirm that the issue is back in Ionic 3.0.0 |
Can anyone that is having the issue in |
@brandyscarney I wouldn't know how to instruct you to reproduce the issue but it seems to be related to angularfire2, firebase or the loading controller, as was the case with this issue initially I assume. If there's anything else I could share, do let me now |
An user on another issue has shown a workaround - or, perhaps, the correct way to do it - which is utilize loading.present().then(() => {}) and only call loading.dismiss() inside the then block. It appears that the loading.dismiss() is being called before the loading component has been presented completely and is thus causing an error. The issue in question: #10588 |
Hi @brandyscarney , Im on "ionic-angular": "3.0.1", and am having same issue. This is how Im using all my loading components.
|
Hello @brandyscarney , I have the same kind of code as @neo-split with the same issue.... Using ionic-angular 3.0.1 as well. Thank you ! |
I am not using firebase for auth. Then when I arrive in user page I use dismiss() and I am getting the issue. By adding the catch it solved the issue. To reproduce it is pretty simple I think: Use https://github.com/aggarwalankush/ionic2-push-base
Then in connectionPage launch a loadingController, call connect and reroot to homePage once resolve.
And then in TabsPage:
I am now getting the issue caught. This is only working when I using I don't know why I am getting such issue since I put push notification. I did not touch this part of the code and the spinner is well dismissed even if I get the error. My version of ionic-angular is 2.1.0. |
Still not working on ionic 3.3.0. Followed https://docs.ionic.io/services/auth/facebook-native.html#injecting-facebookauth-and-user _ main.js:1582 ERROR Error: Uncaught (in promise): [object Object] _ |
This issue has been automatically identified as an Ionic 3 issue. We recently moved Ionic 3 to its own repository. I am moving this issue to the repository for Ionic 3. Please track this issue over there. If I've made a mistake, and if this issue is still relevant to Ionic 4, please let the Ionic Framework team know! Thank you for using Ionic! |
Issue moved to: ionic-team/ionic-v3#145 |
Ionic2 version: 2.0.0-rc.3-201612100458
Following code taken from my app:
will produce following errors the very first time the page is pushed:
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
The text was updated successfully, but these errors were encountered: