@@ -276,9 +276,9 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
276276 addPerformanceEntries ( span , { recordClsOnPageloadSpan : ! enableStandaloneClsSpans } ) ;
277277 setActiveIdleSpan ( client , undefined ) ;
278278
279- // A trace should to stay the consistent over the entire time span of one route.
280- // Therefore, we update the traceId/sampled properties on the propagation context .
281- // When a navigation happens, this is overwritten
279+ // A trace should stay consistent over the entire timespan of one route - even after the pageload/navigation ended .
280+ // Only when another navigation happens, we want to create a new trace .
281+ // This way, e.g. errors that occur after the pageload span ended are still associated to the pageload trace.
282282 const scope = getCurrentScope ( ) ;
283283 const oldPropagationContext = scope . getPropagationContext ( ) ;
284284
@@ -444,7 +444,6 @@ export function startBrowserTracingPageLoadSpan(
444444 * This will only do something if a browser tracing integration has been setup.
445445 */
446446export function startBrowserTracingNavigationSpan ( client : Client , spanOptions : StartSpanOptions ) : Span | undefined {
447- // Reset this to ensure we start a new trace, instead of continuing the last pageload/navigation trace
448447 getIsolationScope ( ) . setPropagationContext ( { traceId : generateTraceId ( ) , sampleRand : Math . random ( ) } ) ;
449448 getCurrentScope ( ) . setPropagationContext ( { traceId : generateTraceId ( ) , sampleRand : Math . random ( ) } ) ;
450449
0 commit comments