@@ -85,7 +85,11 @@ export function createV6CompatibleWrapCreateBrowserRouter<
85
85
86
86
return function ( routes : RouteObject [ ] , opts ?: Record < string , unknown > & { basename ?: string } ) : TRouter {
87
87
routes . forEach ( route => {
88
- allRoutes . add ( route ) ;
88
+ const extractedChildRoutes = getChildRoutesRecursively ( route ) ;
89
+
90
+ extractedChildRoutes . forEach ( r => {
91
+ allRoutes . add ( r ) ;
92
+ } ) ;
89
93
} ) ;
90
94
91
95
const router = createRouterFunction ( routes , opts ) ;
@@ -166,7 +170,11 @@ export function createV6CompatibleWrapCreateMemoryRouter<
166
170
} ,
167
171
) : TRouter {
168
172
routes . forEach ( route => {
169
- allRoutes . add ( route ) ;
173
+ const extractedChildRoutes = getChildRoutesRecursively ( route ) ;
174
+
175
+ extractedChildRoutes . forEach ( r => {
176
+ allRoutes . add ( r ) ;
177
+ } ) ;
170
178
} ) ;
171
179
172
180
const router = createRouterFunction ( routes , opts ) ;
@@ -458,7 +466,9 @@ function getChildRoutesRecursively(route: RouteObject, allRoutes: Set<RouteObjec
458
466
route . children . forEach ( child => {
459
467
const childRoutes = getChildRoutesRecursively ( child , allRoutes ) ;
460
468
461
- childRoutes . forEach ( r => allRoutes . add ( r ) ) ;
469
+ childRoutes . forEach ( r => {
470
+ allRoutes . add ( r ) ;
471
+ } ) ;
462
472
} ) ;
463
473
}
464
474
}
@@ -498,6 +508,11 @@ function rebuildRoutePathFromAllRoutes(allRoutes: RouteObject[], location: Locat
498
508
const path = pickPath ( match ) ;
499
509
const strippedPath = stripBasenameFromPathname ( location . pathname , prefixWithSlash ( match . pathnameBase ) ) ;
500
510
511
+ if ( location . pathname === strippedPath ) {
512
+ return trimSlash ( strippedPath ) ;
513
+ }
514
+
515
+
501
516
return trimSlash (
502
517
trimSlash ( path || '' ) +
503
518
prefixWithSlash (
@@ -588,6 +603,8 @@ function updatePageloadTransaction(
588
603
if ( branches ) {
589
604
let name ,
590
605
source : TransactionSource = 'url' ;
606
+
607
+ debugger ;
591
608
const isInDescendantRoute = locationIsInsideDescendantRoute ( location , allRoutes || routes ) ;
592
609
593
610
if ( isInDescendantRoute ) {
0 commit comments