@angular/ssr 20.0.0-rc.2 → 20.0.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/fesm2022/ssr.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ɵConsole as _Console, ApplicationRef, InjectionToken, provideEnvironmentInitializer, inject, makeEnvironmentProviders, ɵENABLE_ROOT_COMPONENT_BOOTSTRAP as _ENABLE_ROOT_COMPONENT_BOOTSTRAP, Compiler, runInInjectionContext, ɵresetCompiledComponents as _resetCompiledComponents, REQUEST, REQUEST_CONTEXT, RESPONSE_INIT, LOCALE_ID } from '@angular/core';
2
2
  import { platformServer, INITIAL_CONFIG, ɵSERVER_CONTEXT as _SERVER_CONTEXT, ɵrenderInternal as _renderInternal, provideServerRendering as provideServerRendering$1 } from '@angular/platform-server';
3
- import { Router, ROUTES, ɵloadChildren as _loadChildren } from '@angular/router';
3
+ import { ActivatedRoute, Router, ROUTES, ɵloadChildren as _loadChildren } from '@angular/router';
4
4
  import { APP_BASE_HREF, PlatformLocation } from '@angular/common';
5
5
  import Beasties from '../third_party/beasties/index.js';
6
6
 
@@ -358,9 +358,13 @@ async function renderAngular(html, bootstrap, url, platformProviders, serverCont
358
358
  await applicationRef.whenStable();
359
359
  // TODO(alanagius): Find a way to avoid rendering here especially for redirects as any output will be discarded.
360
360
  const envInjector = applicationRef.injector;
361
+ const routerIsProvided = !!envInjector.get(ActivatedRoute, null);
361
362
  const router = envInjector.get(Router);
362
363
  const lastSuccessfulNavigation = router.lastSuccessfulNavigation;
363
- if (lastSuccessfulNavigation?.finalUrl) {
364
+ if (!routerIsProvided) {
365
+ hasNavigationError = false;
366
+ }
367
+ else if (lastSuccessfulNavigation?.finalUrl) {
364
368
  hasNavigationError = false;
365
369
  const { finalUrl, initialUrl } = lastSuccessfulNavigation;
366
370
  const finalUrlStringified = finalUrl.toString();