Skip to content

Commit 2bb53e0

Browse files
committed
if the react-router route matching emits an error, fallback to window.location.pathname
1 parent 99f1523 commit 2bb53e0

File tree

1 file changed

+6
-8
lines changed
  • src/sentry/static/sentry/app/utils

1 file changed

+6
-8
lines changed

src/sentry/static/sentry/app/utils/apm.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export async function normalizeTransactionName(
4343
prevTransactionName = window.location.pathname;
4444
}
4545

46-
const transactionName: string | undefined = await new Promise(function(resolve) {
46+
const transactionName: string = await new Promise(function(resolve) {
4747
Router.match(
4848
{
4949
routes: appRoutes,
@@ -52,7 +52,7 @@ export async function normalizeTransactionName(
5252
(error, _redirectLocation, renderProps) => {
5353
if (error) {
5454
set(event, ['tags', 'transaction.rename.router-match'], 'error');
55-
return resolve(undefined);
55+
return resolve(window.location.pathname);
5656
}
5757

5858
set(event, ['tags', 'transaction.rename.router-match'], 'success');
@@ -68,14 +68,12 @@ export async function normalizeTransactionName(
6868
);
6969
});
7070

71-
if (typeof transactionName === 'string' && transactionName.length) {
72-
event.transaction = transactionName;
71+
event.transaction = transactionName;
7372

74-
set(event, ['tags', 'transaction.rename.before'], prevTransactionName);
75-
set(event, ['tags', 'transaction.rename.after'], transactionName);
73+
set(event, ['tags', 'transaction.rename.before'], prevTransactionName);
74+
set(event, ['tags', 'transaction.rename.after'], transactionName);
7675

77-
set(event, ['tags', 'ui.route'], transactionName);
78-
}
76+
set(event, ['tags', 'ui.route'], transactionName);
7977

8078
return event;
8179
}

0 commit comments

Comments
 (0)