@@ -112,10 +112,7 @@ const allRoutes = new Set<RouteObject>();
112
112
/**
113
113
* Processes resolved routes by adding them to allRoutes and checking for nested async handlers.
114
114
*/
115
- export function processResolvedRoutes (
116
- resolvedRoutes : RouteObject [ ] ,
117
- parentRoute ?: RouteObject ,
118
- currentLocation ?: Location ,
115
+ currentLocation: Location | null = null ,
119
116
) : void {
120
117
resolvedRoutes. forEach ( child => {
121
118
allRoutes . add ( child ) ;
@@ -137,11 +134,7 @@ export function processResolvedRoutes(
137
134
138
135
// Try to use the provided location first, then fall back to global window location if needed
139
136
let location = currentLocation ;
140
- if ( ! location ) {
141
- if ( typeof WINDOW !== 'undefined' ) {
142
- const globalLocation = WINDOW . location ;
143
- if ( globalLocation ) {
144
- location = { pathname : globalLocation . pathname } ;
137
+ location = createDefaultLocation ( globalLocation . pathname ) ;
145
138
}
146
139
}
147
140
}
@@ -553,9 +546,8 @@ function wrapPatchRoutesOnNavigation(
553
546
// Update navigation span after routes are patched
554
547
const activeRootSpan = getActiveRootSpan ( ) ;
555
548
if ( activeRootSpan && ( spanToJSON ( activeRootSpan ) as { op ?: string } ) . op === 'navigation' ) {
556
- // For memory routers, we don't have a reliable way to get the current pathname
557
- // without accessing window.location, so we'll use targetPath for both cases
558
- const pathname = targetPath || ( isMemoryRouter ? WINDOW . location ?. pathname : undefined ) ;
549
+ // For memory routers, we should not access window.location; use targetPath only
550
+ const pathname = isMemoryRouter ? targetPath : targetPath || WINDOW . location ?. pathname ;
559
551
if ( pathname ) {
560
552
updateNavigationSpan (
561
553
activeRootSpan ,
0 commit comments