Skip to content

Commit 3720405

Browse files
committed
adjust
1 parent 7547547 commit 3720405

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/browser/src/tracing/browserTracingIntegration.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
274274
beforeSpanEnd: span => {
275275
_collectWebVitals();
276276
addPerformanceEntries(span, { recordClsOnPageloadSpan: !enableStandaloneClsSpans });
277+
278+
setActiveIdleSpan(client, undefined);
277279
},
278280
});
279281

@@ -491,9 +493,9 @@ function registerInteractionListener(
491493
const registerInteractionTransaction = (): void => {
492494
const op = 'ui.action.click';
493495

494-
const rootSpan = getActiveIdleSpan(client);
495-
if (rootSpan) {
496-
const currentRootSpanOp = spanToJSON(rootSpan).op;
496+
const activeIdleSpan = getActiveIdleSpan(client);
497+
if (activeIdleSpan) {
498+
const currentRootSpanOp = spanToJSON(activeIdleSpan).op;
497499
if (['navigation', 'pageload'].includes(currentRootSpanOp as string)) {
498500
DEBUG_BUILD &&
499501
logger.warn(`[Tracing] Did not create ${op} span because a pageload or navigation span is in progress.`);
@@ -539,6 +541,6 @@ function getActiveIdleSpan(client: Client): Span | undefined {
539541
return (client as { [ACTIVE_IDLE_SPAN_PROPERTY]?: Span })[ACTIVE_IDLE_SPAN_PROPERTY];
540542
}
541543

542-
function setActiveIdleSpan(client: Client, span: Span): void {
544+
function setActiveIdleSpan(client: Client, span: Span | undefined): void {
543545
addNonEnumerableProperty(client, ACTIVE_IDLE_SPAN_PROPERTY, span);
544546
}

0 commit comments

Comments
 (0)