feat(tracing): Wrap Expo Router push, replace, navigate, back, dismiss in addition to prefetch
#6221
2 issues
find-bugs: Found 2 issues (2 low)
Low
Stale pending navigation if `startInactiveSpan` throws inside `wrapNavigationMethod` - `packages/core/src/js/tracing/expoRouter.ts:80-91`
In wrapNavigationMethod (line 170โ191 of the file), setPendingExpoRouterNavigation is called before startInactiveSpan, but only the original.apply call is inside the try/catch that invokes clearPendingExpoRouterNavigation on error. If startInactiveSpan throws, the pending is set and never cleared, so the next unrelated idle navigation span will be incorrectly tagged with a stale navigation.method.
Also found at:
packages/core/test/tracing/expoRouter.test.ts:431-438packages/core/test/tracing/expoRouter.test.ts:13-16
Stale `pendingExpoRouterNavigation` when navigation silently does nothing (e.g. `back()` on empty stack) - `packages/core/src/js/tracing/expoRouter.ts:170-186`
If back() or dismiss() returns normally without throwing but does NOT trigger a React Navigation __unsafe_action__ dispatch (e.g. back() called on an empty navigation stack), the pending value set by setPendingExpoRouterNavigation is never consumed โ only the catch path calls clearPendingExpoRouterNavigation(). A subsequent unrelated React Navigation dispatch (e.g. a deep-link or programmatic navigation outside the wrapped API) will then consume the stale pending and tag its idle navigation span with the wrong navigation.method.
โฑ 18m 55s ยท 1.7M in / 159.3k out ยท $4.45