Skip to content

Commit b94de6f

Browse files
committed
fixup! refactor(@angular/ssr): combine redirect URL parameter helpers and use DefaultUrlSerializer
1 parent 78a8f17 commit b94de6f

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

‎packages/angular/ssr/src/routes/ng-routes.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,9 @@ async function* handleRoute(options: {
179179
const parentRoutes = new Map<string, RouteTreeNodeMetadata>();
180180

181181
if (typeof redirectTo === 'string') {
182-
let routeSegments: string[] | undefined;
183182
// Reference the route parameters by their position in the URL (see `buildUrlWithParams`).
184183
metadata.redirectTo = resolveRedirectTo(parentRoute, route, redirectTo, (parameter) => {
185-
routeSegments ??= joinUrlParts(baseHref, currentRoutePath).split('/');
184+
const routeSegments = joinUrlParts(baseHref, currentRoutePath).split('/');
186185

187186
return `*${routeSegments.lastIndexOf(parameter)}`;
188187
});

‎packages/angular/ssr/src/utils/url.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export function buildUrlWithParams(toUrl: string, fromPath: string, fromSearch?:
205205
.split('/')
206206
.map((part, index) =>
207207
part[0] === '*'
208-
? (fromPathParts[part.length === 1 ? index : +part.slice(1)] ?? part)
208+
? (fromPathParts[part.length === 1 ? index : Number(part.slice(1))] ?? part)
209209
: part,
210210
),
211211
);

0 commit comments

Comments
 (0)