Skip to content

Commit

Permalink
refactor(@angular/ssr): skip rendering root page during route extraction
Browse files Browse the repository at this point in the history
To prevent rendering the root route while extracting routes, a non-existent path (`/ng-extract-routes`) is intentionally used. This ensures unnecessary rendering during the route extraction process where now only the app component is rendered.
  • Loading branch information
alan-agius4 committed Dec 9, 2024
1 parent e126bf9 commit e4d193c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/angular/ssr/src/routes/ng-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,9 @@ export async function getRoutesFromAngularRouterConfig(
const platformRef = platformServer([
{
provide: INITIAL_CONFIG,
useValue: { document, url: `${protocol}//${host}/` },
// The route below is intentionally set to a non-existent path
// to avoid rendering the root route during route extraction.
useValue: { document, url: `${protocol}//${host}/ng-extract-routes` },
},
{
provide: ɵConsole,
Expand Down

0 comments on commit e4d193c

Please sign in to comment.