Skip to content

Commit 64ef836

Browse files
committed
jsdoc and fix cleanup of _pageloadSpan
1 parent 9ac071e commit 64ef836

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

packages/browser/src/tracing/browserTracingIntegration.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,11 @@ export const browserTracingIntegration = ((options: Partial<BrowserTracingOption
437437
sampled: spanIsSampled(idleSpan),
438438
dsc: getDynamicSamplingContextFromSpan(span),
439439
});
440+
441+
if (isPageloadSpan) {
442+
// clean up the stored pageload span on the intergration.
443+
_pageloadSpan = undefined;
444+
}
440445
},
441446
trimIdleSpanEndTimestamp: !explicitPageloadEnd,
442447
});
@@ -606,7 +611,6 @@ export const browserTracingIntegration = ((options: Partial<BrowserTracingOption
606611
if (explicitPageloadEnd && _pageloadSpan) {
607612
_pageloadSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON, 'reportPageLoaded');
608613
_pageloadSpan.end();
609-
_pageloadSpan = undefined;
610614
}
611615
});
612616
},

packages/core/src/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,10 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
606606
) => void,
607607
): () => void;
608608

609+
/**
610+
* A hook for the browser tracing integrations to trigger the end of a page load span.
611+
* @returns {() => void} A function that, when executed, removes the registered callback.
612+
*/
609613
public on(hook: 'endPageloadSpan', callback: () => void): () => void;
610614

611615
/**

0 commit comments

Comments
 (0)