File tree Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -150,17 +150,8 @@ function getRouteStringFromRoutes(routes: Route[]): string {
150
150
}
151
151
}
152
152
153
- const pathParts = routesWithPaths
154
- . slice ( index )
155
- . filter ( ( { path } ) => ! ! path )
156
- . map ( ( { path } ) => path ) ;
157
-
158
- // Join all parts with '/', then replace multiple slashes with a single one.
159
- let fullPath = pathParts . join ( '/' ) ;
160
- fullPath = fullPath . replace ( / \/ + / g, '/' ) ;
161
-
162
- // Edge case: If the path started with multiple slashes and routes,
163
- // like `//foo`, it might become `/foo`. This is generally acceptable.
164
-
165
- return fullPath ;
153
+ return routesWithPaths . slice ( index ) . reduce ( ( acc , { path } ) => {
154
+ const pathSegment = acc === '/' || acc === '' ? path : `/${ path } ` ;
155
+ return `${ acc } ${ pathSegment } ` ;
156
+ } , '' ) ;
166
157
}
You can’t perform that action at this time.
0 commit comments