Endless Page Loading (lazy loading module)
itprodavets opened this issue · 0 comments
Does not work with lazy loading modules (ngrx)
I used => this.oidcFacade.getOidcUser(); in OidcGuardService
export class OidcGuardService implements CanActivate {
constructor(private router: Router, private oidcFacade: OidcFacade) { }
public canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
this.oidcFacade.getOidcUser();
return this.oidcFacade.waitForAuthenticationLoaded().pipe(
switchMap(loading => {
return this.oidcFacade.identity$.pipe(
first(),
switchMap(user => {
if (user && !user.expired) {
return of(true);
} else {
this.router.navigate(['/home']);
return of(false);
}
})
);
})
);
}
}
My routing module:
{
path: 'employee',
loadChildren: () => import('@employee').then(m => m.EmployeeModule),
canActivate: [OidcGuardService],
runGuardsAndResolvers: 'always'
}
I have on the village filters, sorting, pagination which by change causes action load data.
When pressed, endless loading occurs. The action works, but does not cause the next action
if I add it => this.oidcFacade.getOidcUser(), everything will work.
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
Smartphone (if required for specific bug, please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
Additional context
Add any other context about the problem here.