Skip to content

Wrap push, replace, navigate, back, dismiss in addition to prefetch #6158

@alwx

Description

@alwx

wrapExpoRouter() in tracing/expoRouter.ts only wraps prefetch. The ExpoRouter interface already enumerates push, replace, back, navigate, but none of them are instrumented. As a result, programmatic navigations are invisible at the call-site level — we only see the resulting state change via the React Navigation listener, with no link back to the code that triggered it.

Wrap the other router methods so each navigation call:

  • Adds a breadcrumb (category: 'navigation', type: 'navigation') carrying the method (push / replace / navigate / back / dismiss), the target href, and the parsed pathname/params.
  • Associates the call with the subsequent idle navigation transaction so the span can be attributed to the initiating method (e.g. navigation.method = "push").
  • Mirrors the existing prefetch error/status handling (SPAN_STATUS_OK / SPAN_STATUS_ERROR).
  • Is safe to call repeatedly — keep the __sentryPrefetchWrapped guard pattern and extend it to a single __sentryWrapped flag.

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions