@@ -939,6 +939,9 @@ function patchSpanEnd(
939939 return ;
940940 }
941941
942+ // Use the passed route context, or fall back to global Set
943+ const allRoutesSet = _allRoutes ? new Set ( _allRoutes ) : allRoutes ;
944+
942945 const originalEnd = span . end . bind ( span ) ;
943946 let endCalled = false ;
944947
@@ -974,7 +977,7 @@ function patchSpanEnd(
974977
975978 if ( shouldWaitForLazyRoutes ) {
976979 if ( _lazyRouteTimeout === 0 ) {
977- tryUpdateSpanNameBeforeEnd ( span , spanJson , currentName , location , routes , basename , spanType , allRoutes ) ;
980+ tryUpdateSpanNameBeforeEnd ( span , spanJson , currentName , location , routes , basename , spanType , allRoutesSet ) ;
978981 return originalEnd ( ...args ) ;
979982 }
980983
@@ -995,7 +998,7 @@ function patchSpanEnd(
995998 routes ,
996999 basename ,
9971000 spanType ,
998- allRoutes ,
1001+ allRoutesSet ,
9991002 ) ;
10001003 originalEnd ( ...args ) ;
10011004 } )
@@ -1005,7 +1008,7 @@ function patchSpanEnd(
10051008 return ;
10061009 }
10071010
1008- tryUpdateSpanNameBeforeEnd ( span , spanJson , currentName , location , routes , basename , spanType , allRoutes ) ;
1011+ tryUpdateSpanNameBeforeEnd ( span , spanJson , currentName , location , routes , basename , spanType , allRoutesSet ) ;
10091012 return originalEnd ( ...args ) ;
10101013 } ;
10111014
0 commit comments