@@ -13,6 +13,7 @@ interface VueSentry extends ViewModel {
1313 [ key : string ] : Span ;
1414 } ;
1515 $_sentryRootSpan ?: Span ;
16+ $_sentryRootSpanTimer ?: ReturnType < typeof setTimeout > ;
1617}
1718
1819// Mappings from operation to corresponding lifecycle hook.
@@ -23,7 +24,6 @@ const HOOKS: { [key in Operation]: Hook[] } = {
2324 mount : [ 'beforeMount' , 'mounted' ] ,
2425 update : [ 'beforeUpdate' , 'updated' ] ,
2526} ;
26- let ROOT_SPAN_TIMER : ReturnType < typeof setTimeout > ;
2727
2828/** Grabs active transaction off scope, if any */
2929function getActiveTransaction ( ) : Transaction | undefined {
@@ -34,11 +34,11 @@ function getActiveTransaction(): Transaction | undefined {
3434
3535/** Finish top-level span and activity with a debounce configured using `timeout` option */
3636function finishRootSpan ( vm : VueSentry , timestamp : number , timeout : number ) : void {
37- if ( ROOT_SPAN_TIMER ) {
38- clearTimeout ( ROOT_SPAN_TIMER ) ;
37+ if ( vm . $_sentryRootSpanTimer ) {
38+ clearTimeout ( vm . $_sentryRootSpanTimer ) ;
3939 }
4040
41- ROOT_SPAN_TIMER = setTimeout ( ( ) => {
41+ vm . $_sentryRootSpanTimer = setTimeout ( ( ) => {
4242 if ( vm . $root ?. $_sentryRootSpan ) {
4343 vm . $root . $_sentryRootSpan . finish ( timestamp ) ;
4444 vm . $root . $_sentryRootSpan = undefined ;
@@ -95,7 +95,7 @@ export const createTracingMixins = (options: TracingOptions): Mixins => {
9595
9696 if ( span ) {
9797 span . finish ( ) ;
98- finishRootSpan ( this , timestampInSeconds ( ) , options . timeout ) ;
98+ finishRootSpan ( this , timestampInSeconds ( ) , options . timeout || 0 ) ;
9999 } else {
100100 const activeTransaction = this . $root ?. $_sentryRootSpan || getActiveTransaction ( ) ;
101101 if ( activeTransaction ) {
0 commit comments