feat(tracing): Wrap Expo Router push, replace, navigate, back, dismiss in addition to prefetch
#6221
2 issues
code-review: Found 2 issues (1 medium, 1 low)
Medium
Stale `pendingExpoRouterNavigation` leaks to the next unrelated navigation span when `back()`/`dismiss()` is a no-op - `packages/core/src/js/tracing/expoRouter.ts:170-176`
When back() is called on an empty navigation stack (or dismiss() with nothing to dismiss), setPendingExpoRouterNavigation stores a pending value but React Navigation never fires a navigation action, so consumePendingExpoRouterNavigation in startIdleNavigationSpan is never called โ the stale entry persists until the next unrelated navigation fires, incorrectly attributing its span with navigation.method: 'back'. Consider calling clearPendingExpoRouterNavigation() after a short timeout, or after confirming the navigation event fired.
Low
dismiss test omits `consumePendingExpoRouterNavigation` assertion present in the parallel `back` test - `packages/core/test/tracing/expoRouter.test.ts:424-444`
The dismiss test verifies the span and breadcrumb but never asserts that consumePendingExpoRouterNavigation() returns { method: 'dismiss' }, so a regression in setPendingExpoRouterNavigation for dismiss would go undetected.
โฑ 6m 17s ยท 1.1M in / 69.5k out ยท $2.36
Annotations
Check warning on line 176 in packages/core/src/js/tracing/expoRouter.ts
sentry-warden / warden: code-review
Stale `pendingExpoRouterNavigation` leaks to the next unrelated navigation span when `back()`/`dismiss()` is a no-op
When `back()` is called on an empty navigation stack (or `dismiss()` with nothing to dismiss), `setPendingExpoRouterNavigation` stores a pending value but React Navigation never fires a navigation action, so `consumePendingExpoRouterNavigation` in `startIdleNavigationSpan` is never called โ the stale entry persists until the *next* unrelated navigation fires, incorrectly attributing its span with `navigation.method: 'back'`. Consider calling `clearPendingExpoRouterNavigation()` after a short timeout, or after confirming the navigation event fired.