@@ -30,7 +30,8 @@ const HOOKS: { [key in Operation]: Hook[] } = {
3030
3131/** Grabs active transaction off scope, if any */
3232export function getActiveTransaction ( ) : Transaction | undefined {
33- return getCurrentHub ( ) . getScope ( ) ?. getTransaction ( ) ;
33+ const scope = getCurrentHub ( ) . getScope ( ) ;
34+ return scope && scope . getTransaction ( ) ;
3435}
3536
3637/** Finish top-level span and activity with a debounce configured using `timeout` option */
@@ -40,7 +41,7 @@ function finishRootSpan(vm: VueSentry, timestamp: number, timeout: number): void
4041 }
4142
4243 vm . $_sentryRootSpanTimer = setTimeout ( ( ) => {
43- if ( vm . $root ? .$_sentryRootSpan ) {
44+ if ( vm . $root . $_sentryRootSpan ) {
4445 vm . $root . $_sentryRootSpan . finish ( timestamp ) ;
4546 vm . $root . $_sentryRootSpan = undefined ;
4647 }
@@ -96,7 +97,7 @@ export const createTracingMixins = (options: TracingOptions): Mixins => {
9697 // Start a new span if current hook is a 'before' hook.
9798 // Otherwise, retrieve the current span and finish it.
9899 if ( internalHook == internalHooks [ 0 ] ) {
99- const activeTransaction = this . $root ? .$_sentryRootSpan || getActiveTransaction ( ) ;
100+ const activeTransaction = this . $root . $_sentryRootSpan || getActiveTransaction ( ) ;
100101 if ( activeTransaction ) {
101102 // Cancel old span for this hook operation in case it didn't get cleaned up. We're not actually sure if it
102103 // will ever be the case that cleanup hooks re not called, but we had users report that spans didn't get
0 commit comments