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.63.0
Framework Version
React 19.2.4, TanStack Router 1.168.7
Link to Sentry event
No response
Reproduction Example/SDK Setup
import * as Sentry from "@sentry/react";
import { createRouter } from "@tanstack/react-router";
const router = createRouter({
// Your router options...
});
Sentry.init({
dsn: ...,
integrations: [Sentry.tanstackRouterBrowserTracingIntegration(router)],
tracesSampleRate: 1.0,
});
Steps to Reproduce
- Create a TanStack route that redirects in the
beforeLoad or loader with a throw redirect
export const Route = createFileRoute(`/`)({
beforeLoad: () => {
throw Route.redirect({ to: `/test`, replace: true });
},
});
- Start application, visit URL
- Check Sentry traces
- No navigation span for
/test route load
Expected Result
Upon redirect, there should be a navigation span for /test route load
Actual Result
Upon redirect, there is no navigation span for /test. There is only the initial pageload span for /.
Additional Context
This is caused by the TanStack Router bug not emitting onBeforeNavigate if there was a previous redirect thrown in a loader. TanStack/router#3920
Priority
No response
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.63.0
Framework Version
React 19.2.4, TanStack Router 1.168.7
Link to Sentry event
No response
Reproduction Example/SDK Setup
Steps to Reproduce
beforeLoadorloaderwith athrow redirect/testroute loadExpected Result
Upon redirect, there should be a navigation span for
/testroute loadActual Result
Upon redirect, there is no navigation span for
/test. There is only the initial pageload span for/.Additional Context
This is caused by the TanStack Router bug not emitting
onBeforeNavigateif there was a previous redirect thrown in a loader. TanStack/router#3920Priority
No response