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
279279 const sentryTrace = getMetaContent ( 'sentry-trace' ) ;
280280 const baggage = getMetaContent ( 'baggage' ) ;
281281
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
282285 const scope = getCurrentScope ( ) ;
286+ const propagationContextBefore = scope . getPropagationContext ( ) ;
283287
284- // Continue trace updates the _current_ scope, but we want to break out of it again...
285288 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
287290 return withScope ( scope , ( ) => {
288291 return _createRouteSpan ( client , {
289292 op : 'pageload' ,
290293 ...startSpanOptions ,
291294 } ) ;
292295 } ) ;
293296 } ) ;
297+
298+ scope . setPropagationContext ( propagationContextBefore ) ;
294299 } ) ;
295300
296301 if ( options . instrumentPageLoad && WINDOW . location ) {
You can’t perform that action at this time.
0 commit comments