(props: P)
| 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); |
nothing calls this directly
no test coverage detected