Skip to content

fix(react): Support root and wildcard routes in react router v6#5971

Merged
AbhiPrasad merged 1 commit intomasterfrom
abhi-react-router-wildcard-fix
Oct 18, 2022
Merged

fix(react): Support root and wildcard routes in react router v6#5971
AbhiPrasad merged 1 commit intomasterfrom
abhi-react-router-wildcard-fix

Conversation

@AbhiPrasad
Copy link
Contributor

Fixes #5965

This PR does two things for the react router v6 instrumentation.

  1. Makes sure that routes don't appear with double slashes, like with //example or //my-route. This is done with a simple check for pathBuilder[pathBuilder.length - 1] === '/'.

  2. Make sure that wildcard imports will generate proper transaction names. For example with /tests/123 that loads a wildcard route, render /tests/:testId/*. Previously with wildcard routes we would only generate the wildcard portion, so it would render :testId/*.

I'm still undecided if we should even keep the wildcards, but I think they are fine for now.

@AbhiPrasad AbhiPrasad requested review from a team, Lms24 and lforst and removed request for a team October 17, 2022 10:38
@AbhiPrasad AbhiPrasad self-assigned this Oct 17, 2022
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I think having the * in the route makes sense because it represents the users' actual routes and it's still parameterized and low-cardinality.

@AbhiPrasad AbhiPrasad merged commit d9d1115 into master Oct 18, 2022
@AbhiPrasad AbhiPrasad deleted the abhi-react-router-wildcard-fix branch October 18, 2022 12:33
Lms24 added a commit that referenced this pull request Oct 18, 2022
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.

react-router integration doesn't support root and wildcard brances

2 participants