Skip to content

Commit

Permalink
also consider state change in routing instrumentation register
Browse files Browse the repository at this point in the history
  • Loading branch information
jennmueng committed Mar 2, 2021
1 parent 0957cee commit 53b228f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/js/tracing/reactnavigationv5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ export class ReactNavigationV5Instrumentation extends RoutingInstrumentation {
// We create an initial state here to ensure a transaction gets created before the first route mounts.
if (!this._initialStateHandled) {
this._onDispatch();
if (this._navigationContainer) {
// Navigation container already registered, just populate with route state
this._onStateChange();

this._initialStateHandled = true;
}
}
}

Expand Down Expand Up @@ -96,13 +102,9 @@ export class ReactNavigationV5Instrumentation extends RoutingInstrumentation {
if (this._latestTransaction) {
// If registerRoutingInstrumentation was called first _onDispatch has already been called
this._onStateChange();
} else {
logger.log(
"[ReactNavigationV5Instrumentation] Navigation mounted before integration was setup. Initial route transaction was not created."
);
}

this._initialStateHandled = true;
this._initialStateHandled = true;
}
}

_global.__sentry_rn_v5_registered = true;
Expand Down

0 comments on commit 53b228f

Please sign in to comment.