-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Getting user data with async after page refresh takes long time #231
Comments
I've noticed this as well with the switch to beta1 and the 3.0 firebase sdk. By the sound of things I'm doing something similar to you only using Google authentication. There seems to be a fairly major downgrade in the time it takes to retrieve the auth information from firebase compared to the 2.x version. All other database interactions seem unaffected. |
The interesting thing is if you subscribe to
It logs the data pretty fast, there's no waiting there (at least for me). It seems like it's just the view that's affected (?) |
Hmm, from @orangesoup 's description, it sounds like the Angular zone isn't picking up the change. I will look into this this afternoon. |
@jeffbcross I'm not sure whether it's a bug or not, so I'm asking here first and if it is I can open a new issue: I've been debugging my app when I tried out a weird scenario: I have an Edit: since I'm not sure how all this works under the good I've tried out using the proper |
@orangesoup that does sound like a bug; a new issue would be appreciated! There is definitely some complexity in the onAuth pipeline right now to try to have some consistent behavior with the old API. |
There is one place in auth that takes a promise from Firebase, the promise from getRedirectResult(), and creates an observable from it. Since Firebase is using their own Promise implementation, the Promise and its derived observable were running in the root zone instead of the Angular zone, causing onAuth changes to not immediately be propagated to the view. By casting the firebase Promise to a zone-patched Promise, the observable now runs in the Angular zone. Fixes angular#231
Alright, opened a new issue! Thanks for looking at it! |
I couldn't make a plunker, so I'm just gonna try to explain here. - I'm using SDK 3.0.
I have a simple
Password
auth (just an example, probably doesn't matter which one).Works fine, user can log in, data gets stored in localStorage, everything is shiny. However, when I refresh the page it takes almost 10 seconds to show the user data when using
async
pipe.Everything is loaded, I mean literally everything, and then after 8-10 seconds the uid just shows up. If I click the login button while waiting to uid to show up (so at this moment I have my data in localStorage already), the uid shows up instantly (it still makes a login request, but the uid shows up before that request actually finishes).
Honestly, I'm not sure if I'm doing something wrong here and this is an intended behavior (in this case please point me to the right direction), but it's really bad UX.
Not sure if it matters, but my main goal would be to show the users email address if they're logged in, but it's kinda weird when the page loads it shows nothing for ~10 seconds and then just suddenly pops out.
The text was updated successfully, but these errors were encountered: