diff --git a/packages/router/src/provide_router.ts b/packages/router/src/provide_router.ts index a094c99c249..f886e6bdb32 100644 --- a/packages/router/src/provide_router.ts +++ b/packages/router/src/provide_router.ts @@ -314,7 +314,6 @@ export function withEnabledBlockingInitialNavigation(): EnabledBlockingInitialNa useFactory: (injector: Injector) => { const locationInitialized: Promise = injector.get(LOCATION_INITIALIZED, Promise.resolve()); - let initNavigation = false; /** * Performs the given action once the router finishes its next/current navigation. @@ -358,7 +357,6 @@ export function withEnabledBlockingInitialNavigation(): EnabledBlockingInitialNa // Unblock APP_INITIALIZER in case the initial navigation was canceled or errored // without a redirect. resolve(true); - initNavigation = true; }); router.afterPreactivation = () => { @@ -366,13 +364,7 @@ export function withEnabledBlockingInitialNavigation(): EnabledBlockingInitialNa // assume activation will complete successfully (even though this is not // guaranteed). resolve(true); - // only the initial navigation should be delayed until bootstrapping is done. - if (!initNavigation) { - return bootstrapDone.closed ? of(void 0) : bootstrapDone; - // subsequent navigations should not be delayed - } else { - return of(void 0); - } + return bootstrapDone.closed ? of(void 0) : bootstrapDone; }; router.initialNavigation(); }); diff --git a/packages/router/test/bootstrap.spec.ts b/packages/router/test/bootstrap.spec.ts index 51c6b2a4ac9..2a925d69236 100644 --- a/packages/router/test/bootstrap.spec.ts +++ b/packages/router/test/bootstrap.spec.ts @@ -152,8 +152,9 @@ describe('bootstrap', () => { class TestModule { } - await Promise.all( - [platformBrowserDynamic([]).bootstrapModule(TestModule), navigationEndPromise]); + await expectAsync(Promise.all([ + platformBrowserDynamic([]).bootstrapModule(TestModule), navigationEndPromise + ])).toBeResolved(); }); it('should wait for redirect when initialNavigation = enabledBlocking', async () => {