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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(react): Fix react router v4/v5 instrumentation #11855

Merged
merged 1 commit into from
May 2, 2024
Merged

Conversation

mydea
Copy link
Member

@mydea mydea commented Apr 30, 2024

Turns out we were not correctly setting parametrized route names for react router v4/v5 馃槵 We had no proper test covering this.

So I added a new E2E test react-router-5 that actually checks that parametrization etc. works as expected.

Fixes #11815

@mydea mydea requested review from lforst, Lms24 and s1gr1d April 30, 2024 14:42
@mydea mydea self-assigned this Apr 30, 2024
const WrappedRoute: React.FC<P> = (props: P) => {
if (props && props.computedMatch && props.computedMatch.isExact) {
getCurrentScope().setTransactionName(props.computedMatch.path);
const route = props.computedMatch.path;
const activeRootSpan = getActiveRootSpan();
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the actual fix - we got the root span at instrument time, not at route-render time, leading to this not working as expected 馃槵

Copy link
Member

Choose a reason for hiding this comment

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

That's a tricky one! Good catch 馃憤馃徎

@mydea mydea enabled auto-merge (squash) April 30, 2024 15:10
@mydea mydea merged commit a3cac7b into develop May 2, 2024
97 checks passed
@mydea mydea deleted the fn/reactRouterV5 branch May 2, 2024 08:28
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 V5 Integration is not parameterizing transaction names
2 participants