@@ -188,8 +188,10 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
188
188
startTrackingInteractions ( ) ;
189
189
}
190
190
191
- let latestRouteName : string | undefined ;
192
- let latestRouteSource : TransactionSource | undefined ;
191
+ const latestRoute : { name : string | undefined ; source : TransactionSource | undefined } = {
192
+ name : undefined ,
193
+ source : undefined ,
194
+ } ;
193
195
194
196
/** Create routing idle transaction. */
195
197
function _createRouteTransaction ( context : TransactionContext ) : Transaction | undefined {
@@ -235,8 +237,8 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
235
237
: // eslint-disable-next-line deprecation/deprecation
236
238
finalContext . metadata ;
237
239
238
- latestRouteName = finalContext . name ;
239
- latestRouteSource = getSource ( finalContext ) ;
240
+ latestRoute . name = finalContext . name ;
241
+ latestRoute . source = getSource ( finalContext ) ;
240
242
241
243
if ( finalContext . sampled === false ) {
242
244
DEBUG_BUILD && logger . log ( `[Tracing] Will not send ${ finalContext . op } transaction because of beforeNavigate.` ) ;
@@ -384,7 +386,7 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
384
386
}
385
387
386
388
if ( _experiments . enableInteractions ) {
387
- registerInteractionListener ( options , latestRouteName , latestRouteSource ) ;
389
+ registerInteractionListener ( options , latestRoute ) ;
388
390
}
389
391
390
392
instrumentOutgoingRequests ( {
@@ -446,8 +448,7 @@ export function getMetaContent(metaName: string): string | undefined {
446
448
/** Start listener for interaction transactions */
447
449
function registerInteractionListener (
448
450
options : BrowserTracingOptions ,
449
- latestRouteName : string | undefined ,
450
- latestRouteSource : TransactionSource | undefined ,
451
+ latestRoute : { name : string | undefined ; source : TransactionSource | undefined } ,
451
452
) : void {
452
453
let inflightInteractionTransaction : IdleTransaction | undefined ;
453
454
const registerInteractionTransaction = ( ) : void => {
@@ -470,19 +471,19 @@ function registerInteractionListener(
470
471
inflightInteractionTransaction = undefined ;
471
472
}
472
473
473
- if ( ! latestRouteName ) {
474
+ if ( ! latestRoute . name ) {
474
475
DEBUG_BUILD && logger . warn ( `[Tracing] Did not create ${ op } transaction because _latestRouteName is missing.` ) ;
475
476
return undefined ;
476
477
}
477
478
478
479
const { location } = WINDOW ;
479
480
480
481
const context : TransactionContext = {
481
- name : latestRouteName ,
482
+ name : latestRoute . name ,
482
483
op,
483
484
trimEnd : true ,
484
485
data : {
485
- [ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ] : latestRouteSource || 'url' ,
486
+ [ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ] : latestRoute . source || 'url' ,
486
487
} ,
487
488
} ;
488
489
0 commit comments