Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser Tracing causing TanStack Router to be stuck in pending state after v1.98.3 #15234

Closed
3 tasks done
nikolovlazar opened this issue Jan 30, 2025 · 1 comment · Fixed by #15235
Closed
3 tasks done
Labels
Package: react Issues related to the Sentry React SDK

Comments

@nikolovlazar
Copy link
Member

nikolovlazar commented Jan 30, 2025

ℹ️ Originally posted by @MTG2000 on TanStack Router's repo: TanStack/router#3277. Just resurfacing it here.

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

8.51.0

Framework Version

React 18.2.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

StackBlitz by original author: https://stackblitz.com/edit/github-pp1nvw-hhnn1f54?file=src%2Fmain.tsx

Steps to Reproduce

  1. Updated TanStack Router to v1.98.3
  2. Routes stuck in pending state

Expected Result

Routing works

Actual Result

Routes stuck in pending state

@TkDodo
Copy link

TkDodo commented Jan 30, 2025

I think router made a breaking change by making a previously always defined field optional here:

https://github.com/TanStack/router/pull/3191/files#diff-64427616e4d29617d5d71c4a67f2128314a368057c5faa14c8d98a46637787a8R12

-fromLocation: ParsedLocation
+fromLocation?: ParsedLocation

the sentry integration reads fromLocation.state here:

if (onBeforeNavigateArgs.toLocation.state === onBeforeNavigateArgs.fromLocation.state) {

I think we can fix this on our end by adding optional chaining:

if (onBeforeNavigateArgs.toLocation.state === onBeforeNavigateArgs.fromLocation?.state) { 

and maybe update our dependencies to the latest router version to get the correct types. This should be backwards compatible, but we’d need to find all places where we access fromLocation

@Lms24 Lms24 closed this as completed in 0f25452 Jan 30, 2025
Lms24 pushed a commit that referenced this issue Jan 30, 2025
…entation (#15235)

fixes #15234

Due to a big bug in TanStack Router getting fixed, this needs an
optional chain to not die.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: react Issues related to the Sentry React SDK
Projects
Archived in project
2 participants