File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
packages/tracing-internal/src/browser Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -279,18 +279,23 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
279
279
const sentryTrace = getMetaContent ( 'sentry-trace' ) ;
280
280
const baggage = getMetaContent ( 'baggage' ) ;
281
281
282
+ // Continue trace updates the _current_ scope, but we want to break out of it again...
283
+ // This is a bit hacky, because we want to get the span to use both the correct scope _and_ the correct propagation context
284
+ // but afterwards, we want to reset it to avoid this also applying to other spans
282
285
const scope = getCurrentScope ( ) ;
286
+ const propagationContextBefore = scope . getPropagationContext ( ) ;
283
287
284
- // Continue trace updates the _current_ scope, but we want to break out of it again...
285
288
activeSpan = continueTrace ( { sentryTrace, baggage } , ( ) => {
286
- // Ensure we are on the original current scope again
289
+ // Ensure we are on the original current scope again, so the span is set as active on it
287
290
return withScope ( scope , ( ) => {
288
291
return _createRouteSpan ( client , {
289
292
op : 'pageload' ,
290
293
...startSpanOptions ,
291
294
} ) ;
292
295
} ) ;
293
296
} ) ;
297
+
298
+ scope . setPropagationContext ( propagationContextBefore ) ;
294
299
} ) ;
295
300
296
301
if ( options . instrumentPageLoad && WINDOW . location ) {
You can’t perform that action at this time.
0 commit comments