-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/react
SDK Version
7.93.0
Framework Version
18.2.0
Link to Sentry event
No response
SDK Setup
Sentry.init({
dsn: '<dsn here>',
integrations: [
new RewriteFrames({
iteratee: (frame) => ({
...frame,
filename: frame.filename?.replace(document.baseURI, ''),
}),
}),
new Sentry.BrowserTracing({
routingInstrumentation: Sentry.reactRouterV6Instrumentation(
useEffect,
useLocation,
useNavigationType,
createRoutesFromChildren,
matchRoutes,
),
}),
new Sentry.Replay(generateSentryReplayConfig()),
],
})
Steps to Reproduce
Initialize sentry with react router v6.4 data API according to docs. E.g. above sentry init and:
const sentryCreateBrowserRouter =
Sentry.wrapCreateBrowserRouter(createBrowserRouter);
export function createRouter() {
return sentryCreateBrowserRouter(
routes,
{ basename },
);
}When running this in our environment, we see transactions with the current location name show up. E.g.:
baseurl/product/1234-hash-of-this-product-id
Expected Result
We expected transactions to by grouped by the route path as defined in react router, e.g:
product/:productId
As well as without their baseurl.
The source of this seems to be:
| const location = state.location; |
I believe a correct implementation would involve checking the matched routes and using the route path instead:
router.subscribe((state: RouterState) => {
const targetRoute = state.matches
.findLast(match => match.route.path != null)
?.route.path;
if (targetRoute) {
handleNavigation(location, routes, state.HistoryAction, undefined, basename)
}
Actual Result
n/a
Metadata
Metadata
Assignees
Labels
Projects
Status
No status