Skip to content
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

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

Merged
merged 1 commit into from Oct 18, 2022

Conversation

AbhiPrasad
Copy link
Member

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, lforst and Lms24 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