MCPcopy Create free account
hub / github.com/getsentry/sentry-javascript / WrappedRoute

Function WrappedRoute

packages/react/src/reactrouter.tsx:227–244  ·  view source on GitHub ↗
(props: P)

Source from the content-addressed store, hash-verified

225 const componentDisplayName = Route.displayName || Route.name;
226
227 const WrappedRoute: React.FC<P> = (props: P) => {
228 if (props?.computedMatch?.isExact) {
229 const route = props.computedMatch.path;
230 const activeRootSpan = getActiveRootSpan();
231
232 getCurrentScope().setTransactionName(route);
233
234 if (activeRootSpan) {
235 activeRootSpan.updateName(route);
236 activeRootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');
237 }
238 }
239
240 // @ts-expect-error Setting more specific React Component typing for `R` generic above
241 // will break advanced type inference done by react router params:
242 // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13dc4235c069e25fe7ee16e11f529d909f9f3ff8/types/react-router/index.d.ts#L154-L164
243 return <Route {...props} />;
244 };
245
246 WrappedRoute.displayName = `sentryRoute(${componentDisplayName})`;
247 hoistNonReactStatics(WrappedRoute, Route);

Callers

nothing calls this directly

Calls 5

getCurrentScopeFunction · 0.90
setTransactionNameMethod · 0.80
getActiveRootSpanFunction · 0.70
updateNameMethod · 0.65
setAttributeMethod · 0.65

Tested by

no test coverage detected