Skip to content

Commit

Permalink
fix: Sampled needs to be false for v5 to discard it
Browse files Browse the repository at this point in the history
  • Loading branch information
jennmueng committed Mar 2, 2021
1 parent 53b228f commit 735a8d4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/js/tracing/reactnavigationv5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,17 @@ export class ReactNavigationV5Instrumentation extends RoutingInstrumentation {
};
}

if (finalContext.sampled) {
// Note: finalContext.sampled will be false at this point only if the user sets it to be so in beforeNavigate.
if (finalContext.sampled === false) {
logger.log(
`[ReactNavigationV5Instrumentation] Will not send transaction "${finalContext.name}" due to beforeNavigate.`
);
} else {
// Clear the timeout so the transaction does not get cancelled.
if (typeof this._stateChangeTimeout !== "undefined") {
clearTimeout(this._stateChangeTimeout);
this._stateChangeTimeout = undefined;
}
} else {
logger.log(
`[ReactNavigationV5Instrumentation] Will not send transaction "${finalContext.name}" due to beforeNavigate.`
);
}

this._latestTransaction.updateWithContext(finalContext);
Expand Down

0 comments on commit 735a8d4

Please sign in to comment.