feat: Add routing instrumentation for react router v4/v5#2780
Merged
AbhiPrasad merged 3 commits intomasterfrom Aug 10, 2020
Merged
feat: Add routing instrumentation for react router v4/v5#2780AbhiPrasad merged 3 commits intomasterfrom
AbhiPrasad merged 3 commits intomasterfrom
Conversation
eb5ad74 to
8ae7fee
Compare
Contributor
size-limit report
|
8ae7fee to
f41e609
Compare
Contributor
d678e92 to
9887f01
Compare
kamilogorek
pushed a commit
that referenced
this pull request
Aug 10, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
So in React Router v4 and v5, there is no longer a static set of routes we can depend upon to change transaction name.
Take a look at their philosophy for more: https://reactrouter.com/core/guides/philosophy
This means it is hard for us to get all the transaction names without additional user configuration. I have set this up in two ways.
a) They can use a custom Route component to achieve this functionality. This is as every time a Route renders, we get access to the match params (what path they matched with). We can then grab update the name there.
Usage:
b) They can pass us a route config. We accept a config object that is supported by https://github.com/ReactTraining/react-router/tree/master/packages/react-router-config, so something that looks like:
Then usage:
The Route Component matching trumps the config.