-
Notifications
You must be signed in to change notification settings - Fork 2.2k
currentUser | async never resolves, browser hangs #2378
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
Comments
Thanks for the report, will look into this. |
currentUser returns null. getCurrentUser$() {
return this.afAuth.currentUser;
}
// in auth.guard.ts
this.authFireSV.getCurrentUser$().then(
u => {
console.log(' --> currentUser$', u); <--- null
}
) On the other hand, this.afAuth.authState.pipe() method works! authedUser() {
return this.afAuth.authState.pipe(first());
}
I think something is odd . canActivate(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
): Observable<boolean> {
return this.authFireSV.authedUser().pipe(
take(1),
map(u => {
console.log(" authedUser: ", u);
if (u) {
this.authFireSV.getCurrentUser$().then(
u => {
console.log(' --> currentUser$', u);
}
);
return true;
} else {
this.notiSV.warn('Please Do SignIn');
this.router.navigate(['/user']);
return false;
}
})
);
} |
Hi, It is likely that in AUTH.TS at line 50 'shareReplay ({bufferSize: 1, refCount: false})' is allowing only one subscriber to exist const auth = of(undefined).pipe(
observeOn(schedulers.outsideAngular),
switchMap(() => zone.runOutsideAngular(() => import('firebase/auth'))),
map(() => ɵfirebaseAppFactory(options, zone, nameOrConfig)),
map(app => app.auth()),
// I don't understand why share replay just once time
shareReplay({ bufferSize: 1, refCount: false }),
); Thanks. |
Sorry I misunderstood the issue when first looking at it. Our
As for the |
Version info
Angular:
9.1.0
Firebase:
7.13.1
AngularFire:
6.0.0
Other (e.g. Ionic/Cordova, Node, browser, operating system):
chrome 80.0.3987.162, macOS Catalina 10.15.3
How to reproduce these conditions
in component html {{auth.currentUser | async}}
Failing test unit, Plunkr, or JSFiddle demonstrating the problem
Steps to set up and reproduce
Sample data and security rules
<-- include/attach/link to some json sample data (or provide credentials to a sanitized, test Firebase project) -->
Debug output
** Errors in the JavaScript console **
** Output from
firebase.database().enableLogging(true);
**** Screenshots **
Expected behavior
Actual behavior
The text was updated successfully, but these errors were encountered: