-
Notifications
You must be signed in to change notification settings - Fork 2.2k
canActivate is broken on 6.0.0 #2312
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
is this related to #2309 ? |
Interesting, I don't think it's related, as that bug didn't make it's way into the v6 branch. I must have caught it during the rebase. TBH I haven't used auth-guards in the since cutting RC.0, it's entirely possible I broke something since ngcc was very unhappy with that module. I'll give it a spin later today, in the meantime LMK if you figure out anything more. Thanks for testing the release candidate BTW! |
Interesting discussions are going on #2309 and yes, I think this issue is related to that issue. |
I decided to give the RC a try today too. I am noticing when using Usage: import {
AngularFireAuthGuardModule,
redirectLoggedInTo,
canActivate,
} from '@angular/fire/auth-guard';
const redirectLoginToDashboard = () => redirectLoggedInTo(['dashboard']);
const routes: Routes = [
{
path: '',
loadChildren: () => import('@story-squad/pages').then((m) => m.LoginModule),
...canActivate(redirectLoginToDashboard),
},
]; Update: |
Can you give |
Sure! Doing that asap |
@jamesdaniels yes that fixes my issues. To be precise the canActivate on my side was using a service instance. The service onInit was getting the authState and a DB user. Once the service was instanciated the authState would not emit later (only on first call). Thus the canActivate would not return anything (router was waiting) Should also fix @wSedlacek 's issue |
Feel free to close this for me |
Updated to |
@jimmykane glad to hear we fixed it and apologies for the break. Thanks again for the feedback! I created a new issue for us to track the performance regression @wSedlacek, thanks for the profile data. |
Version info
Angular: 9-rc14
Firebase: 7.8.0
AngularFire: 6.0.0-rc0
Other (e.g. Ionic/Cordova, Node, browser, operating system):
How to reproduce these conditions
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
canActivate works
Actual behavior
canActivate doesn't work
The above used to work.
Currently with 6.0.0-rc0 the above doesn't work
Returning
true
or an observable does not allow the route to workThe text was updated successfully, but these errors were encountered: