Skip to content

Commit

Permalink
fix(@angular/ssr): throw error when using route matchers
Browse files Browse the repository at this point in the history
Route matchers are not currently supported in Angular SSR. This commit ensures an error is issued when a route matcher is detected.
  • Loading branch information
alan-agius4 committed Jan 8, 2025
1 parent ebc3cc8 commit 3791541
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion packages/angular/ssr/src/routes/ng-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,25 @@ async function* traverseRoutesConfig(options: {

for (const route of routes) {
try {
const { path = '', redirectTo, loadChildren, loadComponent, children, ɵentryName } = route;
const {
path = '',
matcher,
redirectTo,
loadChildren,
loadComponent,
children,
ɵentryName,
} = route;
const currentRoutePath = joinUrlParts(parentRoute, path);

if (matcher) {
yield {
error: `The route '${stripLeadingSlash(currentRoutePath)}' uses a route matcher which is not supported.`,
};

continue;
}

// Get route metadata from the server config route tree, if available
let matchedMetaData: ServerConfigRouteTreeNodeMetadata | undefined;
if (serverConfigRouteTree) {
Expand Down

0 comments on commit 3791541

Please sign in to comment.