@@ -554,33 +554,38 @@ describe('reactRouterV6BrowserTracingIntegration', () => {
554554 ) ;
555555 const SentryRoutes = withSentryReactRouterV6Routing ( Routes ) ;
556556
557+ const DetailsRoutes = ( ) => (
558+ < SentryRoutes >
559+ < Route path = ":detailId" element = { < div id = "details" > Details</ div > } />
560+ </ SentryRoutes >
561+ ) ;
562+
563+ const ViewsRoutes = ( ) => (
564+ < SentryRoutes >
565+ < Route index element = { < div id = "views" > Views</ div > } />
566+ < Route path = "views/:viewId/*" element = { < DetailsRoutes /> } />
567+ </ SentryRoutes >
568+ ) ;
569+
557570 const ProjectsRoutes = ( ) => (
558571 < SentryRoutes >
559- < Route path = ":projectId" element = { < div > Project Page</ div > } >
560- < Route index element = { < div > Project Page Root</ div > } />
561- < Route element = { < div > Editor</ div > } >
562- < Route path = "*" element = { < Outlet /> } >
563- < Route path = "views/:viewId" element = { < div > View Canvas</ div > } />
564- </ Route >
565- </ Route >
566- </ Route >
572+ < Route path = "projects/:projectId/*" element = { < ViewsRoutes /> } > </ Route >
567573 < Route path = "*" element = { < div > No Match Page</ div > } />
568- < Route path = "/404" element = { < div > 404</ div > } />
569574 </ SentryRoutes >
570575 ) ;
571576
572577 render (
573578 < MemoryRouter initialEntries = { [ '/' ] } >
574579 < SentryRoutes >
575- < Route index element = { < Navigate to = "/projects/123/views/234" /> } />
576- < Route path = "projects /*" element = { < ProjectsRoutes /> } > </ Route >
580+ < Route index element = { < Navigate to = "/projects/123/views/234/567 " /> } />
581+ < Route path = "/*" element = { < ProjectsRoutes /> } > </ Route >
577582 </ SentryRoutes >
578583 </ MemoryRouter > ,
579584 ) ;
580585
581586 expect ( mockStartBrowserTracingNavigationSpan ) . toHaveBeenCalledTimes ( 1 ) ;
582587 expect ( mockStartBrowserTracingNavigationSpan ) . toHaveBeenLastCalledWith ( expect . any ( BrowserClient ) , {
583- name : '/projects/:projectId/views/:viewId' ,
588+ name : '/projects/:projectId/views/:viewId/:detailId ' ,
584589 attributes : {
585590 [ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ] : 'route' ,
586591 [ SEMANTIC_ATTRIBUTE_SENTRY_OP ] : 'navigation' ,
@@ -1147,51 +1152,54 @@ describe('reactRouterV6BrowserTracingIntegration', () => {
11471152
11481153 const wrappedUseRoutes = wrapUseRoutesV6 ( useRoutes ) ;
11491154
1155+ const DetailsRoutes = ( ) =>
1156+ wrappedUseRoutes ( [
1157+ {
1158+ path : ':detailId' ,
1159+ element : < div id = "details" > Details</ div > ,
1160+ } ,
1161+ ] ) ;
1162+
1163+ const ViewsRoutes = ( ) =>
1164+ wrappedUseRoutes ( [
1165+ {
1166+ index : true ,
1167+ element : < div id = "views" > Views</ div > ,
1168+ } ,
1169+ {
1170+ path : 'views/:viewId/*' ,
1171+ element : < DetailsRoutes /> ,
1172+ } ,
1173+ ] ) ;
1174+
11501175 const ProjectsRoutes = ( ) =>
11511176 wrappedUseRoutes ( [
11521177 {
1153- path : ':projectId' ,
1154- element : < div > Project Page</ div > ,
1155- children : [
1156- {
1157- index : true ,
1158- element : < div > Project Page Root</ div > ,
1159- } ,
1160- {
1161- element : < div > Editor</ div > ,
1162- children : [
1163- {
1164- path : '*' ,
1165- element : < Outlet /> ,
1166- children : [
1167- {
1168- path : 'views/:viewId/*' ,
1169- element : < div > View Canvas</ div > ,
1170- } ,
1171- ] ,
1172- } ,
1173- ] ,
1174- } ,
1175- ] ,
1178+ path : 'projects/:projectId/*' ,
1179+ element : < ViewsRoutes /> ,
1180+ } ,
1181+ {
1182+ path : '*' ,
1183+ element : < div > No Match Page</ div > ,
11761184 } ,
11771185 ] ) ;
11781186
11791187 const Routes = ( ) =>
11801188 wrappedUseRoutes ( [
11811189 {
1182- path : 'projects /*' ,
1190+ path : '/*' ,
11831191 element : < ProjectsRoutes /> ,
11841192 } ,
11851193 ] ) ;
11861194
11871195 render (
1188- < MemoryRouter initialEntries = { [ '/projects/123/views/456' ] } >
1196+ < MemoryRouter initialEntries = { [ '/projects/123/views/456/789 ' ] } >
11891197 < Routes />
11901198 </ MemoryRouter > ,
11911199 ) ;
11921200
11931201 expect ( mockStartBrowserTracingPageLoadSpan ) . toHaveBeenCalledTimes ( 1 ) ;
1194- expect ( mockRootSpan . updateName ) . toHaveBeenLastCalledWith ( '/projects/:projectId/views/:viewId' ) ;
1202+ expect ( mockRootSpan . updateName ) . toHaveBeenLastCalledWith ( '/projects/:projectId/views/:viewId/:detailId ' ) ;
11951203 expect ( mockRootSpan . setAttribute ) . toHaveBeenLastCalledWith ( SEMANTIC_ATTRIBUTE_SENTRY_SOURCE , 'route' ) ;
11961204 } ) ;
11971205
@@ -1211,43 +1219,46 @@ describe('reactRouterV6BrowserTracingIntegration', () => {
12111219
12121220 const wrappedUseRoutes = wrapUseRoutesV6 ( useRoutes ) ;
12131221
1222+ const DetailsRoutes = ( ) =>
1223+ wrappedUseRoutes ( [
1224+ {
1225+ path : ':detailId' ,
1226+ element : < div id = "details" > Details</ div > ,
1227+ } ,
1228+ ] ) ;
1229+
1230+ const ViewsRoutes = ( ) =>
1231+ wrappedUseRoutes ( [
1232+ {
1233+ index : true ,
1234+ element : < div id = "views" > Views</ div > ,
1235+ } ,
1236+ {
1237+ path : 'views/:viewId/*' ,
1238+ element : < DetailsRoutes /> ,
1239+ } ,
1240+ ] ) ;
1241+
12141242 const ProjectsRoutes = ( ) =>
12151243 wrappedUseRoutes ( [
12161244 {
1217- path : ':projectId' ,
1218- element : < div > Project Page</ div > ,
1219- children : [
1220- {
1221- index : true ,
1222- element : < div > Project Page Root</ div > ,
1223- } ,
1224- {
1225- element : < div > Editor</ div > ,
1226- children : [
1227- {
1228- path : '*' ,
1229- element : < Outlet /> ,
1230- children : [
1231- {
1232- path : 'views/:viewId/*' ,
1233- element : < div > View Canvas</ div > ,
1234- } ,
1235- ] ,
1236- } ,
1237- ] ,
1238- } ,
1239- ] ,
1245+ path : 'projects/:projectId/*' ,
1246+ element : < ViewsRoutes /> ,
1247+ } ,
1248+ {
1249+ path : '*' ,
1250+ element : < div > No Match Page</ div > ,
12401251 } ,
12411252 ] ) ;
12421253
12431254 const Routes = ( ) =>
12441255 wrappedUseRoutes ( [
12451256 {
12461257 index : true ,
1247- element : < Navigate to = "/projects/123/views/456" /> ,
1258+ element : < Navigate to = "/projects/123/views/456/789 " /> ,
12481259 } ,
12491260 {
1250- path : 'projects /*' ,
1261+ path : '/*' ,
12511262 element : < ProjectsRoutes /> ,
12521263 } ,
12531264 ] ) ;
@@ -1260,7 +1271,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => {
12601271
12611272 expect ( mockStartBrowserTracingNavigationSpan ) . toHaveBeenCalledTimes ( 1 ) ;
12621273 expect ( mockStartBrowserTracingNavigationSpan ) . toHaveBeenLastCalledWith ( expect . any ( BrowserClient ) , {
1263- name : '/projects/:projectId/views/:viewId' ,
1274+ name : '/projects/:projectId/views/:viewId/:detailId ' ,
12641275 attributes : {
12651276 [ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ] : 'route' ,
12661277 [ SEMANTIC_ATTRIBUTE_SENTRY_OP ] : 'navigation' ,
0 commit comments