Skip to content

Commit

Permalink
fix(router): fix change in behaviour on load error occur
Browse files Browse the repository at this point in the history
Clear the stored loader promise so that subsequent load will try the fetch again.
The restores the same behaviour as before we cached the loader to fix  angular#26557
  • Loading branch information
pgammans committed Jan 13, 2021
1 parent fd31cd1 commit 32fa19d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/router/src/router_config_loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import {Compiler, InjectionToken, Injector, NgModuleFactory, NgModuleFactoryLoader} from '@angular/core';
import {from, Observable, of} from 'rxjs';
import {map, mergeMap, share, tap} from 'rxjs/operators';
import {catchError, map, mergeMap, share} from 'rxjs/operators';

import {LoadChildren, LoadedRouterConfig, Route} from './config';
import {flatten, wrapIntoObservable} from './utils/collection';
Expand Down Expand Up @@ -36,6 +36,10 @@ export class RouterConfigLoader {
const moduleFactory$ = this.loadModuleFactory(route.loadChildren!);

route._loader$ = moduleFactory$.pipe(
catchError((err) => {
route._loader$ = undefined;
throw err;
}),
map((factory: NgModuleFactory<any>) => {
if (this.onLoadEndListener) {
this.onLoadEndListener(route);
Expand Down

0 comments on commit 32fa19d

Please sign in to comment.