Skip to content

fix(react): Use history object for init transaction name #3609

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

Merged
merged 1 commit into from
May 27, 2021

Conversation

AbhiPrasad
Copy link
Member

When creating pageload transactions the current react
router v4/v5 relies on global.location.pathname (global
is the current window instance), which can produce
inconsistent basenames. This can cause pageload transctions
to be not paramaterized correctly.

This patch fixes this by using history.location.pathname
to generate pageload transaction names. This was tested locally
to confirm changes.

Closes #3595 #3107

Before submitting a pull request, please take a look at our
Contributing guidelines and verify:

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).

When creating pageload transactions the current react
router v4/v5 relies on global.location.pathname (global
is the current window instance), which can produce
inconsistent basenames. This can cause pageload transctions
to be not paramaterized correctly.

This patch fixes this by using history.location.pathname
to generate pageload transaction names. This was tested locally
to confirm changes.
@AbhiPrasad AbhiPrasad requested a review from HazAT May 27, 2021 16:12
@AbhiPrasad AbhiPrasad requested a review from kamilogorek as a code owner May 27, 2021 16:12
@github-actions
Copy link
Contributor

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 20.76 KB (+0.01% 🔺)
@sentry/browser - Webpack 21.98 KB (0%)
@sentry/react - Webpack 22.01 KB (0%)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 28.16 KB (+0.01% 🔺)

@AbhiPrasad AbhiPrasad merged commit 5b3e06e into master May 27, 2021
@AbhiPrasad AbhiPrasad deleted the abhi/basename-fix branch May 27, 2021 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@sentry/tracing inconsistent transaction names when using history with basename
2 participants