@@ -169,8 +169,10 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
169
169
startTrackingInteractions ( ) ;
170
170
}
171
171
172
- let latestRouteName : string | undefined ;
173
- let latestRouteSource : TransactionSource | undefined ;
172
+ const latestRoute : { name : string | undefined ; source : TransactionSource | undefined } = {
173
+ name : undefined ,
174
+ source : undefined ,
175
+ } ;
174
176
175
177
/** Create routing idle transaction. */
176
178
function _createRouteSpan ( client : Client , startSpanOptions : StartSpanOptions ) : Span {
@@ -190,8 +192,8 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
190
192
finalStartSpanOptions . attributes = attributes ;
191
193
}
192
194
193
- latestRouteName = finalStartSpanOptions . name ;
194
- latestRouteSource = attributes [ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ] ;
195
+ latestRoute . name = finalStartSpanOptions . name ;
196
+ latestRoute . source = attributes [ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ] ;
195
197
196
198
const idleSpan = startIdleSpan ( finalStartSpanOptions , {
197
199
idleTimeout,
@@ -333,7 +335,7 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
333
335
}
334
336
335
337
if ( _experiments . enableInteractions ) {
336
- registerInteractionListener ( options , latestRouteName , latestRouteSource ) ;
338
+ registerInteractionListener ( options , latestRoute ) ;
337
339
}
338
340
339
341
instrumentOutgoingRequests ( {
@@ -404,8 +406,7 @@ export function getMetaContent(metaName: string): string | undefined {
404
406
/** Start listener for interaction transactions */
405
407
function registerInteractionListener (
406
408
options : BrowserTracingOptions ,
407
- latestRouteName : string | undefined ,
408
- latestRouteSource : TransactionSource | undefined ,
409
+ latestRoute : { name : string | undefined ; source : TransactionSource | undefined } ,
409
410
) : void {
410
411
let inflightInteractionSpan : Span | undefined ;
411
412
const registerInteractionTransaction = ( ) : void => {
@@ -429,17 +430,17 @@ function registerInteractionListener(
429
430
inflightInteractionSpan = undefined ;
430
431
}
431
432
432
- if ( ! latestRouteName ) {
433
+ if ( ! latestRoute . name ) {
433
434
DEBUG_BUILD && logger . warn ( `[Tracing] Did not create ${ op } transaction because _latestRouteName is missing.` ) ;
434
435
return undefined ;
435
436
}
436
437
437
438
inflightInteractionSpan = startIdleSpan (
438
439
{
439
- name : latestRouteName ,
440
+ name : latestRoute . name ,
440
441
op,
441
442
attributes : {
442
- [ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ] : latestRouteSource || 'url' ,
443
+ [ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ] : latestRoute . source || 'url' ,
443
444
} ,
444
445
} ,
445
446
{
0 commit comments