Skip to content

Core Web Vitals aren't reported when enabling Tanstack Router integration #18425

@pmdartus

Description

@pmdartus

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/react

SDK Version

10.29.0

Framework Version

React 19.2.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

Demo example: https://github.com/pmdartus/tanstack-sentry-integration-bug-repro/blob/52559b07ab47437e38eb9351eb2500ce2aa916c1/src/main.jsx#L45-L54

Sentry.init({
  dsn: "https://3fc2dae8dcedfae62a6df7e42540440b@o4510449154457600.ingest.de.sentry.io/4510449155965008",
  debug: true,
  sendDefaultPii: true,
  tracesSampleRate: 1.0,
  integrations: [
    Sentry.browserTracingIntegration(),
    Sentry.tanstackRouterBrowserTracingIntegration(router)
  ],
});

Steps to Reproduce

  1. Download the repo and install the dependencies
  2. Start the app by running: npm run dev

Expected Result

All the Core Web Vitals reported on Sentry in the trace, including LCP and CLS.

Actual Result

Only TTFB (and FCP in certain cases are reported) are reported.

Additional Context

Note: Web vitals are correctly reported when disabling the tanstack integration.

After turning on debug mode, it appears that on initial page load the tanstack integration always stop the pageload root span to create a new navigation span. Based on my understanding of how custom routing should be implemented the tanstack router integration should preserving the ongoing pageload span to enable the browser tracing integration to attach the webvitals metrics.

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Metadata

Metadata

Assignees

Labels

BugPackage: reactIssues related to the Sentry React SDK

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions