@@ -78,6 +78,7 @@ function getNormalizedName(
7878 routes : RouteObject [ ] ,
7979 location : Location ,
8080 branches : RouteMatch [ ] ,
81+ basename : string = '' ,
8182) : [ string , TransactionSource ] {
8283 if ( ! routes || routes . length === 0 ) {
8384 return [ location . pathname , 'url' ] ;
@@ -99,7 +100,8 @@ function getNormalizedName(
99100 if ( path ) {
100101 const newPath = path [ 0 ] === '/' || pathBuilder [ pathBuilder . length - 1 ] === '/' ? path : `/${ path } ` ;
101102 pathBuilder += newPath ;
102- if ( branch . pathname === location . pathname ) {
103+
104+ if ( basename + branch . pathname === location . pathname ) {
103105 if (
104106 // If the route defined on the element is something like
105107 // <Route path="/stores/:storeId/products/:productId" element={<div>Product</div>} />
@@ -108,9 +110,9 @@ function getNormalizedName(
108110 // We should not count wildcard operators in the url segments calculation
109111 pathBuilder . slice ( - 2 ) !== '/*'
110112 ) {
111- return [ newPath , 'route' ] ;
113+ return [ basename + newPath , 'route' ] ;
112114 }
113- return [ pathBuilder , 'route' ] ;
115+ return [ basename + pathBuilder , 'route' ] ;
114116 }
115117 }
116118 }
@@ -131,7 +133,7 @@ function updatePageloadTransaction(
131133 : ( _matchRoutes ( routes , location , basename ) as unknown as RouteMatch [ ] ) ;
132134
133135 if ( activeTransaction && branches ) {
134- activeTransaction . setName ( ...getNormalizedName ( routes , location , branches ) ) ;
136+ activeTransaction . setName ( ...getNormalizedName ( routes , location , branches , basename ) ) ;
135137 }
136138}
137139
@@ -149,7 +151,7 @@ function handleNavigation(
149151 activeTransaction . finish ( ) ;
150152 }
151153
152- const [ name , source ] = getNormalizedName ( routes , location , branches ) ;
154+ const [ name , source ] = getNormalizedName ( routes , location , branches , basename ) ;
153155 activeTransaction = _customStartTransaction ( {
154156 name,
155157 op : 'navigation' ,
0 commit comments