You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2c53f06
Browse filesBrowse the repository at this point in the historyBrowse files
fix(tracing): Support Expo Router 58 in expoRouterIntegration (#6923)
* fix(tracing): Support Expo Router 58 in expoRouterIntegration
Expo Router 58 removed the internal router-store module and no longer emits
React Navigation's __unsafe_action__ event. Because 58 declares package
exports, Metro printed an invalid package.json warning for the router-store
require on every bundle, and the integration could not start navigation spans.
The navigation container ref now comes from the public
useNavigationContainerRef export, which returns a module-level ref in
Expo Router 57 and 58. Route info is computed from the root navigation state
with getRouteInfoFromState, which both versions ship at the same path.
On Expo Router 58 the integration listens to the internal actionDispatched
event and starts the idle navigation span through a new internal
_startIdleNavigationSpan method on reactNavigationIntegration. Expo Router 57
has no exports field, so the missing internalNavigationEvents path is a silent
optional dependency there and spans still start from __unsafe_action__.
Fixes#6901
* docs: Add the PR number to the Expo Router 58 changelog entry
Replace the placeholder in the CHANGELOG entry with the PR number, #6923.
* fix(tracing): Keep expoRouterIntegration working on Expo Router 55 to 57
Review of #6923 found two regressions for Expo Router versions before 58.
Expo Router 55 and older do not ship getRouteInfoFromState, so the require
threw and the integration stopped as if expo-router were not installed. The
route info module is now optional. Without it, the integration still
registers the navigation container and skips the route override, so spans
use the React Navigation route names.
In Expo Router 56 and 57, useNavigationContainerRef reads a store that stays
empty until the Root Layout renders. The ref was read once at Sentry.init, so
polling timed out and brought back #6431. The store now reads the ref on every
access, and a throwing call returns undefined so it cannot escape the poll
timer.
The #6431 regression test is restored with the new mocks, and new tests cover
a missing getRouteInfoFromState and a throwing useNavigationContainerRef. The
CHANGELOG entry moves back to the Unreleased section after the 8.32.0 release.
* fix(tracing): Start Expo Router 58 spans only for navigation actions
Expo Router 58 emits actionDispatched for every reducer action, not only
user navigations. On a cold launch with tabs it sends ROUTE_NAMES_CHANGED
and one PRELOAD per tab, and router.prefetch() and param updates send more
PRELOAD, ROUTE_NAMES_CHANGED, and SET_PARAMS actions.
expoRouterIntegration does not enable useDispatchedActionData, so
startIdleNavigationSpan did not filter these. Each one started an idle span
that shipped as an empty "Route Change" transaction on the idle timeout.
The listener now forwards only the known navigation action types (NAVIGATE,
PUSH, REPLACE, GO_BACK, POP, POP_TO, POP_TO_TOP, JUMP_TO, RESET). An
allowlist is safer than a denylist because the router 58 reducer also has
internal actions such as REMOVE_ROUTES and NAVIGATOR_CHANGED.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,7 @@
13
13
- Apply `screenshot` masking options to Android error and feedback screenshots ([#6930](https://github.com/getsentry/sentry-react-native/pull/6930))
14
14
- Persist fatal JS error envelopes to disk on Android before the process exits ([#6937](https://github.com/getsentry/sentry-react-native/pull/6937))
15
15
- The hard-crash envelope was only queued on the transport thread, so the event was lost when React Native terminated the process right after. It is now written to the offline cache on the calling thread and sent on the next launch, matching iOS.
16
+
- Support Expo Router 58 in `expoRouterIntegration`. Metro no longer warns about the removed `expo-router/build/global-state/router-store` module, and the integration creates navigation spans again ([#6923](https://github.com/getsentry/sentry-react-native/pull/6923))
@@ -1337,6 +1338,7 @@ export function wrapTurboModule<T extends object>(name: string, module: T | null
1337
1338
//
1338
1339
// src/js/tracing/reactnativetracing.ts:93:3 - (ae-forgotten-export) The symbol "ReactNativeTracingState" needs to be exported by the entry point index.d.ts
1339
1340
// src/js/tracing/reactnavigation.ts:228:3 - (ae-forgotten-export) The symbol "RouteOverrideProvider" needs to be exported by the entry point index.d.ts
1341
+
// src/js/tracing/reactnavigation.ts:233:3 - (ae-forgotten-export) The symbol "UnsafeAction" needs to be exported by the entry point index.d.ts
1340
1342
1341
1343
// (No @packageDocumentation comment for this package)
0 commit comments