fix(react-router-v3): makes normalizeTransactionName take a callback function #2946
+25
−18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR converts the
normalizeTransactionName
to a function that takes a callback instead of returning a value. This is to fix a bug wherenormalizeTransactionName
returns a value before the callback passed tomatch
is called. In that case, we end up returning the wrong value and the transaction name is incorrect. We see this in Sentry where we get a transaction for/settings/sentry/integrations/
instead of/settings/:orgId/integrations/
. This happens because the callback passed tomatch
might be called asynchronously (https://github.com/ReactTraining/react-router/blob/42fe32d8f4ebec170a6d980badbc702ab88b5897/modules/matchRoutes.js#L249). So we need a callback here as well to get the proper behavior.I tried to test this with Sentry but I think version
5.25.0-beta.2
introduces some breaking changes compared to5.24.2
which is what we currently use.