@@ -554,33 +554,38 @@ describe('reactRouterV6BrowserTracingIntegration', () => {
554
554
) ;
555
555
const SentryRoutes = withSentryReactRouterV6Routing ( Routes ) ;
556
556
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
+
557
570
const ProjectsRoutes = ( ) => (
558
571
< 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 >
567
573
< Route path = "*" element = { < div > No Match Page</ div > } />
568
- < Route path = "/404" element = { < div > 404</ div > } />
569
574
</ SentryRoutes >
570
575
) ;
571
576
572
577
render (
573
578
< MemoryRouter initialEntries = { [ '/' ] } >
574
579
< 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 >
577
582
</ SentryRoutes >
578
583
</ MemoryRouter > ,
579
584
) ;
580
585
581
586
expect ( mockStartBrowserTracingNavigationSpan ) . toHaveBeenCalledTimes ( 1 ) ;
582
587
expect ( mockStartBrowserTracingNavigationSpan ) . toHaveBeenLastCalledWith ( expect . any ( BrowserClient ) , {
583
- name : '/projects/:projectId/views/:viewId' ,
588
+ name : '/projects/:projectId/views/:viewId/:detailId ' ,
584
589
attributes : {
585
590
[ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ] : 'route' ,
586
591
[ SEMANTIC_ATTRIBUTE_SENTRY_OP ] : 'navigation' ,
@@ -1147,51 +1152,54 @@ describe('reactRouterV6BrowserTracingIntegration', () => {
1147
1152
1148
1153
const wrappedUseRoutes = wrapUseRoutesV6 ( useRoutes ) ;
1149
1154
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
+
1150
1175
const ProjectsRoutes = ( ) =>
1151
1176
wrappedUseRoutes ( [
1152
1177
{
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 > ,
1176
1184
} ,
1177
1185
] ) ;
1178
1186
1179
1187
const Routes = ( ) =>
1180
1188
wrappedUseRoutes ( [
1181
1189
{
1182
- path : 'projects /*' ,
1190
+ path : '/*' ,
1183
1191
element : < ProjectsRoutes /> ,
1184
1192
} ,
1185
1193
] ) ;
1186
1194
1187
1195
render (
1188
- < MemoryRouter initialEntries = { [ '/projects/123/views/456' ] } >
1196
+ < MemoryRouter initialEntries = { [ '/projects/123/views/456/789 ' ] } >
1189
1197
< Routes />
1190
1198
</ MemoryRouter > ,
1191
1199
) ;
1192
1200
1193
1201
expect ( mockStartBrowserTracingPageLoadSpan ) . toHaveBeenCalledTimes ( 1 ) ;
1194
- expect ( mockRootSpan . updateName ) . toHaveBeenLastCalledWith ( '/projects/:projectId/views/:viewId' ) ;
1202
+ expect ( mockRootSpan . updateName ) . toHaveBeenLastCalledWith ( '/projects/:projectId/views/:viewId/:detailId ' ) ;
1195
1203
expect ( mockRootSpan . setAttribute ) . toHaveBeenLastCalledWith ( SEMANTIC_ATTRIBUTE_SENTRY_SOURCE , 'route' ) ;
1196
1204
} ) ;
1197
1205
@@ -1211,43 +1219,46 @@ describe('reactRouterV6BrowserTracingIntegration', () => {
1211
1219
1212
1220
const wrappedUseRoutes = wrapUseRoutesV6 ( useRoutes ) ;
1213
1221
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
+
1214
1242
const ProjectsRoutes = ( ) =>
1215
1243
wrappedUseRoutes ( [
1216
1244
{
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 > ,
1240
1251
} ,
1241
1252
] ) ;
1242
1253
1243
1254
const Routes = ( ) =>
1244
1255
wrappedUseRoutes ( [
1245
1256
{
1246
1257
index : true ,
1247
- element : < Navigate to = "/projects/123/views/456" /> ,
1258
+ element : < Navigate to = "/projects/123/views/456/789 " /> ,
1248
1259
} ,
1249
1260
{
1250
- path : 'projects /*' ,
1261
+ path : '/*' ,
1251
1262
element : < ProjectsRoutes /> ,
1252
1263
} ,
1253
1264
] ) ;
@@ -1260,7 +1271,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => {
1260
1271
1261
1272
expect ( mockStartBrowserTracingNavigationSpan ) . toHaveBeenCalledTimes ( 1 ) ;
1262
1273
expect ( mockStartBrowserTracingNavigationSpan ) . toHaveBeenLastCalledWith ( expect . any ( BrowserClient ) , {
1263
- name : '/projects/:projectId/views/:viewId' ,
1274
+ name : '/projects/:projectId/views/:viewId/:detailId ' ,
1264
1275
attributes : {
1265
1276
[ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ] : 'route' ,
1266
1277
[ SEMANTIC_ATTRIBUTE_SENTRY_OP ] : 'navigation' ,
0 commit comments