From 960bf3c115652a4ab25896c3b8e9471ab2970fc8 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Wed, 22 Jan 2025 09:58:10 +0000 Subject: [PATCH] refactor(@angular/ssr): remove unused `segment` property from metadata The `segment` property within the route-tree metadata is redundant and serves no functional purpose. Therefore, it has been removed. --- packages/angular/ssr/src/routes/route-tree.ts | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/packages/angular/ssr/src/routes/route-tree.ts b/packages/angular/ssr/src/routes/route-tree.ts index e592bcb7aac9..6a0360679a0d 100644 --- a/packages/angular/ssr/src/routes/route-tree.ts +++ b/packages/angular/ssr/src/routes/route-tree.ts @@ -78,14 +78,6 @@ export interface RouteTreeNodeMetadata { * The `AdditionalMetadata` type parameter allows for extending the node metadata with custom data. */ interface RouteTreeNode> { - /** - * The segment value associated with this node. - * A segment is a single part of a route path, typically delimited by slashes (`/`). - * For example, in the route `/users/:id/profile`, the segments are `users`, `:id`, and `profile`. - * Segments can also be wildcards (`*`), which match any segment in that position of the route. - */ - segment: string; - /** * The index indicating the order in which the route was inserted into the tree. * This index helps determine the priority of routes during matching, with lower indexes @@ -116,7 +108,7 @@ export class RouteTree = {}> * The root node of the route tree. * All routes are stored and accessed relative to this root node. */ - private readonly root = this.createEmptyRouteTreeNode(''); + private readonly root = this.createEmptyRouteTreeNode(); /** * A counter that tracks the order of route insertion. @@ -144,7 +136,7 @@ export class RouteTree = {}> let childNode = node.children.get(normalizedSegment); if (!childNode) { - childNode = this.createEmptyRouteTreeNode(normalizedSegment); + childNode = this.createEmptyRouteTreeNode(); node.children.set(normalizedSegment, childNode); } @@ -311,15 +303,13 @@ export class RouteTree = {}> } /** - * Creates an empty route tree node with the specified segment. + * Creates an empty route tree node. * This helper function is used during the tree construction. * - * @param segment - The route segment that this node represents. * @returns A new, empty route tree node. */ - private createEmptyRouteTreeNode(segment: string): RouteTreeNode { + private createEmptyRouteTreeNode(): RouteTreeNode { return { - segment, insertionIndex: -1, children: new Map(), };