fix(react-router): Ensure that all browser spans have source=route#16984
fix(react-router): Ensure that all browser spans have source=route#16984
source=route#16984Conversation
RulaKhaled
left a comment
There was a problem hiding this comment.
Some tests are failing but otherwise looks good
fa36b0b to
4dda614
Compare
There was a problem hiding this comment.
Bug: Router Patching Dependent on Pageload Span
The router.navigate patching logic was moved inside the if (pageloadSpan) block. Consequently, if no active pageload span exists when the router is instrumented, router.navigate is not patched, preventing navigation transaction creation. This also creates an inconsistency, as the router subscription for updating navigation spans remains outside this block, attempting to update spans that were never created. Navigation patching should occur independently of pageload span existence.
packages/react-router/src/client/hydratedRouter.ts#L54-L66
sentry-javascript/packages/react-router/src/client/hydratedRouter.ts
Lines 54 to 66 in 4dda614
Was this report helpful? Give feedback by reacting with 👍 or 👎
…16984) This updates the browser tracing implementation in react router to ensure that we always have parametrized routes. In the previous implementation, if the parametrized route was the same as the "initial" one, we would just do nothing and the source remains URL. We would also not set the origin of the spans. this is not correct, because we actually ensured this is parametrized (there are simply no parameters in, but still!), so the source should still be `route` in this case.
This updates the browser tracing implementation in react router to ensure that we always have parametrized routes.
In the previous implementation, if the parametrized route was the same as the "initial" one, we would just do nothing and the source remains URL. We would also not set the origin of the spans. this is not correct, because we actually ensured this is parametrized (there are simply no parameters in, but still!), so the source should still be
routein this case.