File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ type Mixins = Parameters<Vue['mixin']>[0];
1313interface VueSentry extends ViewModel {
1414 readonly $root : VueSentry ;
1515 $_sentrySpans ?: {
16- [ key : string ] : Span ;
16+ [ key : string ] : Span | undefined ;
1717 } ;
1818 $_sentryRootSpan ?: Span ;
1919 $_sentryRootSpanTimer ?: ReturnType < typeof setTimeout > ;
@@ -98,6 +98,14 @@ export const createTracingMixins = (options: TracingOptions): Mixins => {
9898 if ( internalHook == internalHooks [ 0 ] ) {
9999 const activeTransaction = this . $root ?. $_sentryRootSpan || getActiveTransaction ( ) ;
100100 if ( activeTransaction ) {
101+ // Cancel old span for this hook operation in case it didn't get cleaned up. We're not actually sure if it
102+ // will ever be the case that cleanup hooks re not called, but we had users report that spans didn't get
103+ // finished so we finish the span before starting a new one, just to be sure.
104+ const oldSpan = this . $_sentrySpans [ operation ] ;
105+ if ( oldSpan && ! oldSpan . endTimestamp ) {
106+ oldSpan . finish ( ) ;
107+ }
108+
101109 this . $_sentrySpans [ operation ] = activeTransaction . startChild ( {
102110 description : `Vue <${ name } >` ,
103111 op : `${ VUE_OP } .${ operation } ` ,
You can’t perform that action at this time.
0 commit comments