@@ -146,7 +146,7 @@ export function init(
146146 tracing : false ,
147147 ...options ,
148148 tracingOptions : {
149- hooks : [ 'mount' , 'update' ] ,
149+ hooks : [ 'activate' , ' mount', 'update' ] ,
150150 timeout : 2000 ,
151151 trackComponents : false ,
152152 ...options . tracingOptions ,
@@ -270,22 +270,23 @@ export class VueHelper {
270270 ? this . _options . tracingOptions . trackComponents . indexOf ( name ) > - 1
271271 : this . _options . tracingOptions . trackComponents ;
272272
273- if ( ! this . _rootSpan || ! shouldTrack ) {
273+ const childOf = this . _rootSpan || getActiveTransaction ( getCurrentHub ( ) ) ;
274+
275+ if ( ! childOf || ! shouldTrack ) {
274276 return ;
275277 }
276278
277279 const now = timestampWithMs ( ) ;
278280 const span = spans [ operation ] ;
279-
280281 // On the first handler call (before), it'll be undefined, as `$once` will add it in the future.
281282 // However, on the second call (after), it'll be already in place.
282283 if ( span ) {
283284 span . finish ( ) ;
284285 this . _finishRootSpan ( now ) ;
285286 } else {
286287 vm . $once ( `hook:${ hook } ` , ( ) => {
287- if ( this . _rootSpan ) {
288- spans [ operation ] = this . _rootSpan . startChild ( {
288+ if ( childOf ) {
289+ spans [ operation ] = childOf . startChild ( {
289290 description : `Vue <${ name } >` ,
290291 op : operation ,
291292 } ) ;
@@ -332,6 +333,7 @@ export class VueHelper {
332333 // We should always finish the span, only should pop activity if using @sentry/apm
333334 if ( this . _rootSpan ) {
334335 this . _rootSpan . finish ( timestamp ) ;
336+ this . _rootSpan = undefined ;
335337 }
336338 } , this . _options . tracingOptions . timeout ) ;
337339 }
0 commit comments