@sentry/react 10.10.0 → 10.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/error.js +5 -2
- package/build/cjs/error.js.map +1 -1
- package/build/cjs/errorboundary.js +3 -1
- package/build/cjs/errorboundary.js.map +1 -1
- package/build/cjs/reactrouter-compat-utils/instrumentation.js +15 -112
- package/build/cjs/reactrouter-compat-utils/instrumentation.js.map +1 -1
- package/build/cjs/reactrouter-compat-utils/utils.js +0 -32
- package/build/cjs/reactrouter-compat-utils/utils.js.map +1 -1
- package/build/esm/error.js +5 -2
- package/build/esm/error.js.map +1 -1
- package/build/esm/errorboundary.js +3 -1
- package/build/esm/errorboundary.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/reactrouter-compat-utils/instrumentation.js +17 -112
- package/build/esm/reactrouter-compat-utils/instrumentation.js.map +1 -1
- package/build/esm/reactrouter-compat-utils/utils.js +1 -32
- package/build/esm/reactrouter-compat-utils/utils.js.map +1 -1
- package/build/types/error.d.ts.map +1 -1
- package/build/types/errorboundary.d.ts.map +1 -1
- package/build/types/reactrouter-compat-utils/index.d.ts +2 -2
- package/build/types/reactrouter-compat-utils/index.d.ts.map +1 -1
- package/build/types/reactrouter-compat-utils/instrumentation.d.ts +1 -10
- package/build/types/reactrouter-compat-utils/instrumentation.d.ts.map +1 -1
- package/build/types/reactrouter-compat-utils/utils.d.ts +0 -6
- package/build/types/reactrouter-compat-utils/utils.d.ts.map +1 -1
- package/build/types-ts3.8/reactrouter-compat-utils/index.d.ts +2 -2
- package/build/types-ts3.8/reactrouter-compat-utils/instrumentation.d.ts +1 -10
- package/build/types-ts3.8/reactrouter-compat-utils/utils.d.ts +0 -6
- package/package.json +3 -3
package/build/cjs/error.js
CHANGED
|
@@ -96,8 +96,11 @@ function reactErrorHandler(
|
|
|
96
96
|
) {
|
|
97
97
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
98
98
|
return (error, errorInfo) => {
|
|
99
|
-
const
|
|
100
|
-
|
|
99
|
+
const hasCallback = !!callback;
|
|
100
|
+
const eventId = captureReactException(error, errorInfo, {
|
|
101
|
+
mechanism: { handled: hasCallback, type: 'auto.function.react.error_handler' },
|
|
102
|
+
});
|
|
103
|
+
if (hasCallback) {
|
|
101
104
|
callback(error, errorInfo, eventId);
|
|
102
105
|
}
|
|
103
106
|
};
|
package/build/cjs/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sources":["../../src/error.ts"],"sourcesContent":["import { captureException, withScope } from '@sentry/browser';\nimport { isError } from '@sentry/core';\nimport type { ErrorInfo } from 'react';\nimport { version } from 'react';\n\n/**\n * See if React major version is 17+ by parsing version string.\n */\nexport function isAtLeastReact17(reactVersion: string): boolean {\n const reactMajor = reactVersion.match(/^([^.]+)/);\n return reactMajor !== null && parseInt(reactMajor[0]) >= 17;\n}\n\n/**\n * Recurse through `error.cause` chain to set cause on an error.\n */\nexport function setCause(error: Error & { cause?: Error }, cause: Error): void {\n const seenErrors = new WeakSet();\n\n function recurse(error: Error & { cause?: Error }, cause: Error): void {\n // If we've already seen the error, there is a recursive loop somewhere in the error's\n // cause chain. Let's just bail out then to prevent a stack overflow.\n if (seenErrors.has(error)) {\n return;\n }\n if (error.cause) {\n seenErrors.add(error);\n return recurse(error.cause, cause);\n }\n error.cause = cause;\n }\n\n recurse(error, cause);\n}\n\n/**\n * Captures an error that was thrown by a React ErrorBoundary or React root.\n *\n * @param error The error to capture.\n * @param errorInfo The errorInfo provided by React.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured Sentry event.\n */\nexport function captureReactException(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n error: any,\n { componentStack }: ErrorInfo,\n hint?: Parameters<typeof captureException>[1],\n): string {\n // If on React version >= 17, create stack trace from componentStack param and links\n // to to the original error using `error.cause` otherwise relies on error param for stacktrace.\n // Linking errors requires the `LinkedErrors` integration be enabled.\n // See: https://reactjs.org/blog/2020/08/10/react-v17-rc.html#native-component-stacks\n //\n // Although `componentDidCatch` is typed to accept an `Error` object, it can also be invoked\n // with non-error objects. This is why we need to check if the error is an error-like object.\n // See: https://github.com/getsentry/sentry-javascript/issues/6167\n if (isAtLeastReact17(version) && isError(error) && componentStack) {\n const errorBoundaryError = new Error(error.message);\n errorBoundaryError.name = `React ErrorBoundary ${error.name}`;\n errorBoundaryError.stack = componentStack;\n\n // Using the `LinkedErrors` integration to link the errors together.\n setCause(error, errorBoundaryError);\n }\n\n return withScope(scope => {\n scope.setContext('react', { componentStack });\n return captureException(error, hint);\n });\n}\n\n/**\n * Creates an error handler that can be used with the `onCaughtError`, `onUncaughtError`,\n * and `onRecoverableError` options in `createRoot` and `hydrateRoot` React DOM methods.\n *\n * @param callback An optional callback that will be called after the error is captured.\n * Use this to add custom handling for errors.\n *\n * @example\n *\n * ```JavaScript\n * const root = createRoot(container, {\n * onCaughtError: Sentry.reactErrorHandler(),\n * onUncaughtError: Sentry.reactErrorHandler((error, errorInfo) => {\n * console.warn('Caught error', error, errorInfo.componentStack);\n * });\n * });\n * ```\n */\nexport function reactErrorHandler(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n callback?: (error: any, errorInfo: ErrorInfo, eventId: string) => void,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): (error: any, errorInfo: ErrorInfo) => void {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (error: any, errorInfo: ErrorInfo) => {\n const eventId = captureReactException(error, errorInfo);\n if (
|
|
1
|
+
{"version":3,"file":"error.js","sources":["../../src/error.ts"],"sourcesContent":["import { captureException, withScope } from '@sentry/browser';\nimport { isError } from '@sentry/core';\nimport type { ErrorInfo } from 'react';\nimport { version } from 'react';\n\n/**\n * See if React major version is 17+ by parsing version string.\n */\nexport function isAtLeastReact17(reactVersion: string): boolean {\n const reactMajor = reactVersion.match(/^([^.]+)/);\n return reactMajor !== null && parseInt(reactMajor[0]) >= 17;\n}\n\n/**\n * Recurse through `error.cause` chain to set cause on an error.\n */\nexport function setCause(error: Error & { cause?: Error }, cause: Error): void {\n const seenErrors = new WeakSet();\n\n function recurse(error: Error & { cause?: Error }, cause: Error): void {\n // If we've already seen the error, there is a recursive loop somewhere in the error's\n // cause chain. Let's just bail out then to prevent a stack overflow.\n if (seenErrors.has(error)) {\n return;\n }\n if (error.cause) {\n seenErrors.add(error);\n return recurse(error.cause, cause);\n }\n error.cause = cause;\n }\n\n recurse(error, cause);\n}\n\n/**\n * Captures an error that was thrown by a React ErrorBoundary or React root.\n *\n * @param error The error to capture.\n * @param errorInfo The errorInfo provided by React.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured Sentry event.\n */\nexport function captureReactException(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n error: any,\n { componentStack }: ErrorInfo,\n hint?: Parameters<typeof captureException>[1],\n): string {\n // If on React version >= 17, create stack trace from componentStack param and links\n // to to the original error using `error.cause` otherwise relies on error param for stacktrace.\n // Linking errors requires the `LinkedErrors` integration be enabled.\n // See: https://reactjs.org/blog/2020/08/10/react-v17-rc.html#native-component-stacks\n //\n // Although `componentDidCatch` is typed to accept an `Error` object, it can also be invoked\n // with non-error objects. This is why we need to check if the error is an error-like object.\n // See: https://github.com/getsentry/sentry-javascript/issues/6167\n if (isAtLeastReact17(version) && isError(error) && componentStack) {\n const errorBoundaryError = new Error(error.message);\n errorBoundaryError.name = `React ErrorBoundary ${error.name}`;\n errorBoundaryError.stack = componentStack;\n\n // Using the `LinkedErrors` integration to link the errors together.\n setCause(error, errorBoundaryError);\n }\n\n return withScope(scope => {\n scope.setContext('react', { componentStack });\n return captureException(error, hint);\n });\n}\n\n/**\n * Creates an error handler that can be used with the `onCaughtError`, `onUncaughtError`,\n * and `onRecoverableError` options in `createRoot` and `hydrateRoot` React DOM methods.\n *\n * @param callback An optional callback that will be called after the error is captured.\n * Use this to add custom handling for errors.\n *\n * @example\n *\n * ```JavaScript\n * const root = createRoot(container, {\n * onCaughtError: Sentry.reactErrorHandler(),\n * onUncaughtError: Sentry.reactErrorHandler((error, errorInfo) => {\n * console.warn('Caught error', error, errorInfo.componentStack);\n * });\n * });\n * ```\n */\nexport function reactErrorHandler(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n callback?: (error: any, errorInfo: ErrorInfo, eventId: string) => void,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): (error: any, errorInfo: ErrorInfo) => void {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (error: any, errorInfo: ErrorInfo) => {\n const hasCallback = !!callback;\n const eventId = captureReactException(error, errorInfo, {\n mechanism: { handled: hasCallback, type: 'auto.function.react.error_handler' },\n });\n if (hasCallback) {\n callback(error, errorInfo, eventId);\n }\n };\n}\n"],"names":["version","isError","withScope","captureException"],"mappings":";;;;;;AAKA;AACA;AACA;AACO,SAAS,gBAAgB,CAAC,YAAY,EAAmB;AAChE,EAAE,MAAM,aAAa,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC;AACnD,EAAE,OAAO,UAAA,KAAe,IAAA,IAAQ,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA,IAAK,EAAE;AAC7D;;AAEA;AACA;AACA;AACO,SAAS,QAAQ,CAAC,KAAK,EAA6B,KAAK,EAAe;AAC/E,EAAE,MAAM,UAAA,GAAa,IAAI,OAAO,EAAE;;AAElC,EAAE,SAAS,OAAO,CAAC,KAAK,EAA6B,KAAK,EAAe;AACzE;AACA;AACA,IAAI,IAAI,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;AAC/B,MAAM;AACN;AACA,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE;AACrB,MAAM,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC;AAC3B,MAAM,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC;AACxC;AACA,IAAI,KAAK,CAAC,KAAA,GAAQ,KAAK;AACvB;;AAEA,EAAE,O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AAA,EAAA,OAAA,CAAA;AACA;AACA,GAAA;AACA;;;;;;;"}
|
|
@@ -49,7 +49,9 @@ class ErrorBoundary extends React.Component {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
const handled = this.props.handled != null ? this.props.handled : !!this.props.fallback;
|
|
52
|
-
const eventId = error.captureReactException(error$1, errorInfo, {
|
|
52
|
+
const eventId = error.captureReactException(error$1, errorInfo, {
|
|
53
|
+
mechanism: { handled, type: 'auto.function.react.error_boundary' },
|
|
54
|
+
});
|
|
53
55
|
|
|
54
56
|
if (onError) {
|
|
55
57
|
onError(error$1, componentStack, eventId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorboundary.js","sources":["../../src/errorboundary.tsx"],"sourcesContent":["import type { ReportDialogOptions } from '@sentry/browser';\nimport { getClient, showReportDialog, withScope } from '@sentry/browser';\nimport type { Scope } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport * as React from 'react';\nimport { DEBUG_BUILD } from './debug-build';\nimport { captureReactException } from './error';\nimport { hoistNonReactStatics } from './hoist-non-react-statics';\n\nexport const UNKNOWN_COMPONENT = 'unknown';\n\nexport type FallbackRender = (errorData: {\n error: unknown;\n componentStack: string;\n eventId: string;\n resetError(): void;\n}) => React.ReactElement;\n\ntype OnUnmountType = {\n (error: null, componentStack: null, eventId: null): void;\n (error: unknown, componentStack: string, eventId: string): void;\n};\n\nexport type ErrorBoundaryProps = {\n children?: React.ReactNode | (() => React.ReactNode);\n /** If a Sentry report dialog should be rendered on error */\n showDialog?: boolean | undefined;\n /**\n * Options to be passed into the Sentry report dialog.\n * No-op if {@link showDialog} is false.\n */\n dialogOptions?: ReportDialogOptions | undefined;\n /**\n * A fallback component that gets rendered when the error boundary encounters an error.\n *\n * Can either provide a React Component, or a function that returns React Component as\n * a valid fallback prop. If a function is provided, the function will be called with\n * the error, the component stack, and an function that resets the error boundary on error.\n *\n */\n fallback?: React.ReactElement | FallbackRender | undefined;\n /**\n * If set to `true` or `false`, the error `handled` property will be set to the given value.\n * If unset, the default behaviour is to rely on the presence of the `fallback` prop to determine\n * if the error was handled or not.\n */\n handled?: boolean | undefined;\n /** Called when the error boundary encounters an error */\n onError?: ((error: unknown, componentStack: string, eventId: string) => void) | undefined;\n /** Called on componentDidMount() */\n onMount?: (() => void) | undefined;\n /**\n * Called when the error boundary resets due to a reset call from the\n * fallback render props function.\n */\n onReset?: ((error: unknown, componentStack: string, eventId: string) => void) | undefined;\n /**\n * Called on componentWillUnmount() with the error, componentStack, and eventId.\n *\n * If the error boundary never encountered an error, the error\n * componentStack, and eventId will be null.\n */\n onUnmount?: OnUnmountType | undefined;\n /** Called before the error is captured by Sentry, allows for you to add tags or context using the scope */\n beforeCapture?: ((scope: Scope, error: unknown, componentStack: string) => void) | undefined;\n};\n\ntype ErrorBoundaryState =\n | {\n componentStack: null;\n error: null;\n eventId: null;\n }\n | {\n componentStack: React.ErrorInfo['componentStack'];\n error: unknown;\n eventId: string;\n };\n\nconst INITIAL_STATE: ErrorBoundaryState = {\n componentStack: null,\n error: null,\n eventId: null,\n};\n\n/**\n * A ErrorBoundary component that logs errors to Sentry.\n * NOTE: If you are a Sentry user, and you are seeing this stack frame, it means the\n * Sentry React SDK ErrorBoundary caught an error invoking your application code. This\n * is expected behavior and NOT indicative of a bug with the Sentry React SDK.\n */\nclass ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {\n public state: ErrorBoundaryState;\n\n private readonly _openFallbackReportDialog: boolean;\n\n private _lastEventId?: string;\n private _cleanupHook?: () => void;\n\n public constructor(props: ErrorBoundaryProps) {\n super(props);\n\n this.state = INITIAL_STATE;\n this._openFallbackReportDialog = true;\n\n const client = getClient();\n if (client && props.showDialog) {\n this._openFallbackReportDialog = false;\n this._cleanupHook = client.on('afterSendEvent', event => {\n if (!event.type && this._lastEventId && event.event_id === this._lastEventId) {\n showReportDialog({ ...props.dialogOptions, eventId: this._lastEventId });\n }\n });\n }\n }\n\n public componentDidCatch(error: unknown, errorInfo: React.ErrorInfo): void {\n const { componentStack } = errorInfo;\n const { beforeCapture, onError, showDialog, dialogOptions } = this.props;\n withScope(scope => {\n if (beforeCapture) {\n beforeCapture(scope, error, componentStack);\n }\n\n const handled = this.props.handled != null ? this.props.handled : !!this.props.fallback;\n const eventId = captureReactException(error, errorInfo, { mechanism: { handled } });\n\n if (onError) {\n onError(error, componentStack, eventId);\n }\n if (showDialog) {\n this._lastEventId = eventId;\n if (this._openFallbackReportDialog) {\n showReportDialog({ ...dialogOptions, eventId });\n }\n }\n\n // componentDidCatch is used over getDerivedStateFromError\n // so that componentStack is accessible through state.\n this.setState({ error, componentStack, eventId });\n });\n }\n\n public componentDidMount(): void {\n const { onMount } = this.props;\n if (onMount) {\n onMount();\n }\n }\n\n public componentWillUnmount(): void {\n const { error, componentStack, eventId } = this.state;\n const { onUnmount } = this.props;\n if (onUnmount) {\n if (this.state === INITIAL_STATE) {\n // If the error boundary never encountered an error, call onUnmount with null values\n onUnmount(null, null, null);\n } else {\n // `componentStack` and `eventId` are guaranteed to be non-null here because `onUnmount` is only called\n // when the error boundary has already encountered an error.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n onUnmount(error, componentStack!, eventId!);\n }\n }\n\n if (this._cleanupHook) {\n this._cleanupHook();\n this._cleanupHook = undefined;\n }\n }\n\n public resetErrorBoundary(): void {\n const { onReset } = this.props;\n const { error, componentStack, eventId } = this.state;\n if (onReset) {\n // `componentStack` and `eventId` are guaranteed to be non-null here because `onReset` is only called\n // when the error boundary has already encountered an error.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n onReset(error, componentStack!, eventId!);\n }\n this.setState(INITIAL_STATE);\n }\n\n public render(): React.ReactNode {\n const { fallback, children } = this.props;\n const state = this.state;\n\n // `componentStack` is only null in the initial state, when no error has been captured.\n // If an error has been captured, `componentStack` will be a string.\n // We cannot check `state.error` because null can be thrown as an error.\n if (state.componentStack === null) {\n return typeof children === 'function' ? children() : children;\n }\n\n const element =\n typeof fallback === 'function'\n ? React.createElement(fallback, {\n error: state.error,\n componentStack: state.componentStack,\n resetError: () => this.resetErrorBoundary(),\n eventId: state.eventId,\n })\n : fallback;\n\n if (React.isValidElement(element)) {\n return element;\n }\n\n if (fallback) {\n DEBUG_BUILD && debug.warn('fallback did not produce a valid ReactElement');\n }\n\n // Fail gracefully if no fallback provided or is not valid\n return null;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction withErrorBoundary<P extends Record<string, any>>(\n WrappedComponent: React.ComponentType<P>,\n errorBoundaryOptions: ErrorBoundaryProps,\n): React.FC<P> {\n const componentDisplayName = WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;\n\n const Wrapped = React.memo((props: P) => (\n <ErrorBoundary {...errorBoundaryOptions}>\n <WrappedComponent {...props} />\n </ErrorBoundary>\n )) as unknown as React.FC<P>;\n\n Wrapped.displayName = `errorBoundary(${componentDisplayName})`;\n\n // Copy over static methods from Wrapped component to Profiler HOC\n // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over\n hoistNonReactStatics(Wrapped, WrappedComponent);\n return Wrapped;\n}\n\nexport { ErrorBoundary, withErrorBoundary };\n"],"names":["getClient","showReportDialog","error","withScope","captureReactException","DEBUG_BUILD","debug","hoistNonReactStatics"],"mappings":";;;;;;;;;AASO,MAAM,iBAAA,GAAoB;;AAsEjC,MAAM,aAAa,GAAuB;AAC1C,EAAE,cAAc,EAAE,IAAI;AACtB,EAAE,KAAK,EAAE,IAAI;AACb,EAAE,OAAO,EAAE,IAAI;AACf,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,aAAA,SAAsB,KAAK,CAAC,SAAS,CAAyC;;AAQpF,GAAS,WAAW,CAAC,KAAK,EAAsB;AAChD,IAAI,KAAK,CAAC,KAAK,CAAC;;AAEhB,IAAI,IAAI,CAAC,KAAA,GAAQ,aAAa;AAC9B,IAAI,IAAI,CAAC,yBAAA,GAA4B,IA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AAI,oBAAoB;AAC3C,QAAM,KAAA,CAAA,aAAA,CAAC,gBAAA,EAAA,EAAiB,GAAI,KAAK;AACjC;AACA,GAAG,CAAA;;AAEH,EAAE,OAAO,CAAC,WAAA,GAAc,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAC,CAAC;;AAEhE;AACA;AACA,EAAEC,yCAAoB,CAAC,OAAO,EAAE,gBAAgB,CAAC;AACjD,EAAE,OAAO,OAAO;AAChB;;;;;;"}
|
|
1
|
+
{"version":3,"file":"errorboundary.js","sources":["../../src/errorboundary.tsx"],"sourcesContent":["import type { ReportDialogOptions } from '@sentry/browser';\nimport { getClient, showReportDialog, withScope } from '@sentry/browser';\nimport type { Scope } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport * as React from 'react';\nimport { DEBUG_BUILD } from './debug-build';\nimport { captureReactException } from './error';\nimport { hoistNonReactStatics } from './hoist-non-react-statics';\n\nexport const UNKNOWN_COMPONENT = 'unknown';\n\nexport type FallbackRender = (errorData: {\n error: unknown;\n componentStack: string;\n eventId: string;\n resetError(): void;\n}) => React.ReactElement;\n\ntype OnUnmountType = {\n (error: null, componentStack: null, eventId: null): void;\n (error: unknown, componentStack: string, eventId: string): void;\n};\n\nexport type ErrorBoundaryProps = {\n children?: React.ReactNode | (() => React.ReactNode);\n /** If a Sentry report dialog should be rendered on error */\n showDialog?: boolean | undefined;\n /**\n * Options to be passed into the Sentry report dialog.\n * No-op if {@link showDialog} is false.\n */\n dialogOptions?: ReportDialogOptions | undefined;\n /**\n * A fallback component that gets rendered when the error boundary encounters an error.\n *\n * Can either provide a React Component, or a function that returns React Component as\n * a valid fallback prop. If a function is provided, the function will be called with\n * the error, the component stack, and an function that resets the error boundary on error.\n *\n */\n fallback?: React.ReactElement | FallbackRender | undefined;\n /**\n * If set to `true` or `false`, the error `handled` property will be set to the given value.\n * If unset, the default behaviour is to rely on the presence of the `fallback` prop to determine\n * if the error was handled or not.\n */\n handled?: boolean | undefined;\n /** Called when the error boundary encounters an error */\n onError?: ((error: unknown, componentStack: string, eventId: string) => void) | undefined;\n /** Called on componentDidMount() */\n onMount?: (() => void) | undefined;\n /**\n * Called when the error boundary resets due to a reset call from the\n * fallback render props function.\n */\n onReset?: ((error: unknown, componentStack: string, eventId: string) => void) | undefined;\n /**\n * Called on componentWillUnmount() with the error, componentStack, and eventId.\n *\n * If the error boundary never encountered an error, the error\n * componentStack, and eventId will be null.\n */\n onUnmount?: OnUnmountType | undefined;\n /** Called before the error is captured by Sentry, allows for you to add tags or context using the scope */\n beforeCapture?: ((scope: Scope, error: unknown, componentStack: string) => void) | undefined;\n};\n\ntype ErrorBoundaryState =\n | {\n componentStack: null;\n error: null;\n eventId: null;\n }\n | {\n componentStack: React.ErrorInfo['componentStack'];\n error: unknown;\n eventId: string;\n };\n\nconst INITIAL_STATE: ErrorBoundaryState = {\n componentStack: null,\n error: null,\n eventId: null,\n};\n\n/**\n * A ErrorBoundary component that logs errors to Sentry.\n * NOTE: If you are a Sentry user, and you are seeing this stack frame, it means the\n * Sentry React SDK ErrorBoundary caught an error invoking your application code. This\n * is expected behavior and NOT indicative of a bug with the Sentry React SDK.\n */\nclass ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {\n public state: ErrorBoundaryState;\n\n private readonly _openFallbackReportDialog: boolean;\n\n private _lastEventId?: string;\n private _cleanupHook?: () => void;\n\n public constructor(props: ErrorBoundaryProps) {\n super(props);\n\n this.state = INITIAL_STATE;\n this._openFallbackReportDialog = true;\n\n const client = getClient();\n if (client && props.showDialog) {\n this._openFallbackReportDialog = false;\n this._cleanupHook = client.on('afterSendEvent', event => {\n if (!event.type && this._lastEventId && event.event_id === this._lastEventId) {\n showReportDialog({ ...props.dialogOptions, eventId: this._lastEventId });\n }\n });\n }\n }\n\n public componentDidCatch(error: unknown, errorInfo: React.ErrorInfo): void {\n const { componentStack } = errorInfo;\n const { beforeCapture, onError, showDialog, dialogOptions } = this.props;\n withScope(scope => {\n if (beforeCapture) {\n beforeCapture(scope, error, componentStack);\n }\n\n const handled = this.props.handled != null ? this.props.handled : !!this.props.fallback;\n const eventId = captureReactException(error, errorInfo, {\n mechanism: { handled, type: 'auto.function.react.error_boundary' },\n });\n\n if (onError) {\n onError(error, componentStack, eventId);\n }\n if (showDialog) {\n this._lastEventId = eventId;\n if (this._openFallbackReportDialog) {\n showReportDialog({ ...dialogOptions, eventId });\n }\n }\n\n // componentDidCatch is used over getDerivedStateFromError\n // so that componentStack is accessible through state.\n this.setState({ error, componentStack, eventId });\n });\n }\n\n public componentDidMount(): void {\n const { onMount } = this.props;\n if (onMount) {\n onMount();\n }\n }\n\n public componentWillUnmount(): void {\n const { error, componentStack, eventId } = this.state;\n const { onUnmount } = this.props;\n if (onUnmount) {\n if (this.state === INITIAL_STATE) {\n // If the error boundary never encountered an error, call onUnmount with null values\n onUnmount(null, null, null);\n } else {\n // `componentStack` and `eventId` are guaranteed to be non-null here because `onUnmount` is only called\n // when the error boundary has already encountered an error.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n onUnmount(error, componentStack!, eventId!);\n }\n }\n\n if (this._cleanupHook) {\n this._cleanupHook();\n this._cleanupHook = undefined;\n }\n }\n\n public resetErrorBoundary(): void {\n const { onReset } = this.props;\n const { error, componentStack, eventId } = this.state;\n if (onReset) {\n // `componentStack` and `eventId` are guaranteed to be non-null here because `onReset` is only called\n // when the error boundary has already encountered an error.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n onReset(error, componentStack!, eventId!);\n }\n this.setState(INITIAL_STATE);\n }\n\n public render(): React.ReactNode {\n const { fallback, children } = this.props;\n const state = this.state;\n\n // `componentStack` is only null in the initial state, when no error has been captured.\n // If an error has been captured, `componentStack` will be a string.\n // We cannot check `state.error` because null can be thrown as an error.\n if (state.componentStack === null) {\n return typeof children === 'function' ? children() : children;\n }\n\n const element =\n typeof fallback === 'function'\n ? React.createElement(fallback, {\n error: state.error,\n componentStack: state.componentStack,\n resetError: () => this.resetErrorBoundary(),\n eventId: state.eventId,\n })\n : fallback;\n\n if (React.isValidElement(element)) {\n return element;\n }\n\n if (fallback) {\n DEBUG_BUILD && debug.warn('fallback did not produce a valid ReactElement');\n }\n\n // Fail gracefully if no fallback provided or is not valid\n return null;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction withErrorBoundary<P extends Record<string, any>>(\n WrappedComponent: React.ComponentType<P>,\n errorBoundaryOptions: ErrorBoundaryProps,\n): React.FC<P> {\n const componentDisplayName = WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;\n\n const Wrapped = React.memo((props: P) => (\n <ErrorBoundary {...errorBoundaryOptions}>\n <WrappedComponent {...props} />\n </ErrorBoundary>\n )) as unknown as React.FC<P>;\n\n Wrapped.displayName = `errorBoundary(${componentDisplayName})`;\n\n // Copy over static methods from Wrapped component to Profiler HOC\n // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over\n hoistNonReactStatics(Wrapped, WrappedComponent);\n return Wrapped;\n}\n\nexport { ErrorBoundary, withErrorBoundary };\n"],"names":["getClient","showReportDialog","error","withScope","captureReactException","DEBUG_BUILD","debug","hoistNonReactStatics"],"mappings":";;;;;;;;;AASO,MAAM,iBAAA,GAAoB;;AAsEjC,MAAM,aAAa,GAAuB;AAC1C,EAAE,cAAc,EAAE,IAAI;AACtB,EAAE,KAAK,EAAE,IAAI;AACb,EAAE,OAAO,EAAE,IAAI;AACf,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,aAAA,SAAsB,KAAK,CAAC,SAAS,CAAyC;;AAQpF,GAAS,WAAW,CAAC,KAAK,EAAsB;AAChD,IAAI,KAAK,CAAC,KAAK,CAAC;;AAEhB,IAAI,IAAI,CAAC,KAAA,GAAQ,aAAa;AAC9B,IAAI,IAAI,CAAC,yBAAA,GAA4B,IAAI;;AAEzC,IAAI,MAAM,MAAA,GAASA,iBAAS,EAAE;AAC9B,IAAI,IAAI,MAAA,IAAU,KAAK,CA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,EAAiB,GAAI,KAAK;AACjC;AACA,GAAG,CAAA;;AAEH,EAAE,OAAO,CAAC,WAAA,GAAc,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAC,CAAC;;AAEhE;AACA;AACA,EAAEC,yCAAoB,CAAC,OAAO,EAAE,gBAAgB,CAAC;AACjD,EAAE,OAAO,OAAO;AAChB;;;;;;"}
|
|
@@ -114,11 +114,7 @@ function updateNavigationSpan(
|
|
|
114
114
|
// Check if this span has already been named to avoid multiple updates
|
|
115
115
|
// But allow updates if this is a forced update (e.g., when lazy routes are loaded)
|
|
116
116
|
const hasBeenNamed =
|
|
117
|
-
!forceUpdate &&
|
|
118
|
-
(
|
|
119
|
-
activeRootSpan
|
|
120
|
-
|
|
121
|
-
)?.__sentry_navigation_name_set__;
|
|
117
|
+
!forceUpdate && (activeRootSpan )?.__sentry_navigation_name_set__;
|
|
122
118
|
|
|
123
119
|
if (!hasBeenNamed) {
|
|
124
120
|
// Get fresh branches for the current location with all loaded routes
|
|
@@ -288,13 +284,7 @@ function createV6CompatibleWrapCreateMemoryRouter
|
|
|
288
284
|
: router.state.location;
|
|
289
285
|
|
|
290
286
|
if (router.state.historyAction === 'POP' && activeRootSpan) {
|
|
291
|
-
updatePageloadTransaction({
|
|
292
|
-
activeRootSpan,
|
|
293
|
-
location,
|
|
294
|
-
routes,
|
|
295
|
-
basename,
|
|
296
|
-
allRoutes: Array.from(allRoutes),
|
|
297
|
-
});
|
|
287
|
+
updatePageloadTransaction({ activeRootSpan, location, routes, basename, allRoutes: Array.from(allRoutes) });
|
|
298
288
|
}
|
|
299
289
|
|
|
300
290
|
router.subscribe((state) => {
|
|
@@ -322,11 +312,7 @@ function createReactRouterV6CompatibleTracingIntegration(
|
|
|
322
312
|
options,
|
|
323
313
|
version,
|
|
324
314
|
) {
|
|
325
|
-
const integration = browser.browserTracingIntegration({
|
|
326
|
-
...options,
|
|
327
|
-
instrumentPageLoad: false,
|
|
328
|
-
instrumentNavigation: false,
|
|
329
|
-
});
|
|
315
|
+
const integration = browser.browserTracingIntegration({ ...options, instrumentPageLoad: false, instrumentNavigation: false });
|
|
330
316
|
|
|
331
317
|
const {
|
|
332
318
|
useEffect,
|
|
@@ -463,13 +449,7 @@ function wrapPatchRoutesOnNavigation(
|
|
|
463
449
|
if (activeRootSpan && (core.spanToJSON(activeRootSpan) ).op === 'navigation') {
|
|
464
450
|
updateNavigationSpan(
|
|
465
451
|
activeRootSpan,
|
|
466
|
-
{
|
|
467
|
-
pathname: targetPath,
|
|
468
|
-
search: '',
|
|
469
|
-
hash: '',
|
|
470
|
-
state: null,
|
|
471
|
-
key: 'default',
|
|
472
|
-
},
|
|
452
|
+
{ pathname: targetPath, search: '', hash: '', state: null, key: 'default' },
|
|
473
453
|
Array.from(allRoutes),
|
|
474
454
|
true, // forceUpdate = true since we're loading lazy routes
|
|
475
455
|
_matchRoutes,
|
|
@@ -490,13 +470,7 @@ function wrapPatchRoutesOnNavigation(
|
|
|
490
470
|
if (pathname) {
|
|
491
471
|
updateNavigationSpan(
|
|
492
472
|
activeRootSpan,
|
|
493
|
-
{
|
|
494
|
-
pathname,
|
|
495
|
-
search: '',
|
|
496
|
-
hash: '',
|
|
497
|
-
state: null,
|
|
498
|
-
key: 'default',
|
|
499
|
-
},
|
|
473
|
+
{ pathname, search: '', hash: '', state: null, key: 'default' },
|
|
500
474
|
Array.from(allRoutes),
|
|
501
475
|
false, // forceUpdate = false since this is after lazy routes are loaded
|
|
502
476
|
_matchRoutes,
|
|
@@ -529,18 +503,20 @@ function handleNavigation(opts
|
|
|
529
503
|
basename,
|
|
530
504
|
);
|
|
531
505
|
|
|
532
|
-
// Check if this might be a lazy route context
|
|
533
|
-
const isLazyRouteContext = utils.isLikelyLazyRouteContext(allRoutes || routes, location);
|
|
534
|
-
|
|
535
506
|
const activeSpan = core.getActiveSpan();
|
|
536
507
|
const spanJson = activeSpan && core.spanToJSON(activeSpan);
|
|
537
508
|
const isAlreadyInNavigationSpan = spanJson?.op === 'navigation';
|
|
538
509
|
|
|
539
510
|
// Cross usage can result in multiple navigation spans being created without this check
|
|
540
|
-
if (isAlreadyInNavigationSpan
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
511
|
+
if (!isAlreadyInNavigationSpan) {
|
|
512
|
+
browser.startBrowserTracingNavigationSpan(client, {
|
|
513
|
+
name,
|
|
514
|
+
attributes: {
|
|
515
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,
|
|
516
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',
|
|
517
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.navigation.react.reactrouter_v${version}`,
|
|
518
|
+
},
|
|
519
|
+
});
|
|
544
520
|
}
|
|
545
521
|
}
|
|
546
522
|
}
|
|
@@ -646,13 +622,7 @@ function createV6CompatibleWithSentryReactRouterRouting(
|
|
|
646
622
|
});
|
|
647
623
|
isMountRenderPass.current = false;
|
|
648
624
|
} else {
|
|
649
|
-
handleNavigation({
|
|
650
|
-
location,
|
|
651
|
-
routes,
|
|
652
|
-
navigationType,
|
|
653
|
-
version,
|
|
654
|
-
allRoutes: Array.from(allRoutes),
|
|
655
|
-
});
|
|
625
|
+
handleNavigation({ location, routes, navigationType, version, allRoutes: Array.from(allRoutes) });
|
|
656
626
|
}
|
|
657
627
|
},
|
|
658
628
|
// `props.children` is purposely not included in the dependency array, because we do not want to re-run this effect
|
|
@@ -686,79 +656,12 @@ function getActiveRootSpan() {
|
|
|
686
656
|
return op === 'navigation' || op === 'pageload' ? rootSpan : undefined;
|
|
687
657
|
}
|
|
688
658
|
|
|
689
|
-
/**
|
|
690
|
-
* Handles updating an existing navigation span
|
|
691
|
-
*/
|
|
692
|
-
function handleExistingNavigationSpan(
|
|
693
|
-
activeSpan,
|
|
694
|
-
spanJson,
|
|
695
|
-
name,
|
|
696
|
-
source,
|
|
697
|
-
isLikelyLazyRoute,
|
|
698
|
-
) {
|
|
699
|
-
// Check if we've already set the name for this span using a custom property
|
|
700
|
-
const hasBeenNamed = (
|
|
701
|
-
activeSpan
|
|
702
|
-
|
|
703
|
-
)?.__sentry_navigation_name_set__;
|
|
704
|
-
|
|
705
|
-
if (!hasBeenNamed) {
|
|
706
|
-
// This is the first time we're setting the name for this span
|
|
707
|
-
if (!spanJson.timestamp) {
|
|
708
|
-
activeSpan?.updateName(name);
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
// For lazy routes, don't mark as named yet so it can be updated later
|
|
712
|
-
if (!isLikelyLazyRoute) {
|
|
713
|
-
core.addNonEnumerableProperty(
|
|
714
|
-
activeSpan ,
|
|
715
|
-
'__sentry_navigation_name_set__',
|
|
716
|
-
true,
|
|
717
|
-
);
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
// Always set the source attribute to keep it consistent with the current route
|
|
722
|
-
activeSpan?.setAttribute(core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
/**
|
|
726
|
-
* Creates a new navigation span
|
|
727
|
-
*/
|
|
728
|
-
function createNewNavigationSpan(
|
|
729
|
-
client,
|
|
730
|
-
name,
|
|
731
|
-
source,
|
|
732
|
-
version,
|
|
733
|
-
isLikelyLazyRoute,
|
|
734
|
-
) {
|
|
735
|
-
const newSpan = browser.startBrowserTracingNavigationSpan(client, {
|
|
736
|
-
name,
|
|
737
|
-
attributes: {
|
|
738
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,
|
|
739
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',
|
|
740
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.navigation.react.reactrouter_v${version}`,
|
|
741
|
-
},
|
|
742
|
-
});
|
|
743
|
-
|
|
744
|
-
// For lazy routes, don't mark as named yet so it can be updated later when the route loads
|
|
745
|
-
if (!isLikelyLazyRoute && newSpan) {
|
|
746
|
-
core.addNonEnumerableProperty(
|
|
747
|
-
newSpan ,
|
|
748
|
-
'__sentry_navigation_name_set__',
|
|
749
|
-
true,
|
|
750
|
-
);
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
|
|
754
659
|
exports.addResolvedRoutesToParent = addResolvedRoutesToParent;
|
|
755
|
-
exports.createNewNavigationSpan = createNewNavigationSpan;
|
|
756
660
|
exports.createReactRouterV6CompatibleTracingIntegration = createReactRouterV6CompatibleTracingIntegration;
|
|
757
661
|
exports.createV6CompatibleWithSentryReactRouterRouting = createV6CompatibleWithSentryReactRouterRouting;
|
|
758
662
|
exports.createV6CompatibleWrapCreateBrowserRouter = createV6CompatibleWrapCreateBrowserRouter;
|
|
759
663
|
exports.createV6CompatibleWrapCreateMemoryRouter = createV6CompatibleWrapCreateMemoryRouter;
|
|
760
664
|
exports.createV6CompatibleWrapUseRoutes = createV6CompatibleWrapUseRoutes;
|
|
761
|
-
exports.handleExistingNavigationSpan = handleExistingNavigationSpan;
|
|
762
665
|
exports.handleNavigation = handleNavigation;
|
|
763
666
|
exports.processResolvedRoutes = processResolvedRoutes;
|
|
764
667
|
exports.updateNavigationSpan = updateNavigationSpan;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sources":["../../../src/reactrouter-compat-utils/instrumentation.tsx"],"sourcesContent":["/* eslint-disable max-lines */\n// Inspired from Donnie McNeal's solution:\n// https://gist.github.com/wontondon/e8c4bdf2888875e4c755712e99279536\n\nimport {\n browserTracingIntegration,\n startBrowserTracingNavigationSpan,\n startBrowserTracingPageLoadSpan,\n WINDOW,\n} from '@sentry/browser';\nimport type { Client, Integration, Span, TransactionSource } from '@sentry/core';\nimport {\n addNonEnumerableProperty,\n debug,\n getActiveSpan,\n getClient,\n getCurrentScope,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n spanToJSON,\n} from '@sentry/core';\nimport * as React from 'react';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { hoistNonReactStatics } from '../hoist-non-react-statics';\nimport type {\n Action,\n AgnosticDataRouteMatch,\n CreateRouterFunction,\n CreateRoutesFromChildren,\n Location,\n MatchRoutes,\n RouteMatch,\n RouteObject,\n Router,\n RouterState,\n UseEffect,\n UseLocation,\n UseNavigationType,\n UseRoutes,\n} from '../types';\nimport { checkRouteForAsyncHandler } from './lazy-routes';\nimport {\n getNormalizedName,\n initializeRouterUtils,\n isLikelyLazyRouteContext,\n locationIsInsideDescendantRoute,\n prefixWithSlash,\n rebuildRoutePathFromAllRoutes,\n resolveRouteNameAndSource,\n} from './utils';\n\nlet _useEffect: UseEffect;\nlet _useLocation: UseLocation;\nlet _useNavigationType: UseNavigationType;\nlet _createRoutesFromChildren: CreateRoutesFromChildren;\nlet _matchRoutes: MatchRoutes;\nlet _enableAsyncRouteHandlers: boolean = false;\n\nconst CLIENTS_WITH_INSTRUMENT_NAVIGATION = new WeakSet<Client>();\n\n/**\n * Adds resolved routes as children to the parent route.\n * Prevents duplicate routes by checking if they already exist.\n */\nexport function addResolvedRoutesToParent(resolvedRoutes: RouteObject[], parentRoute: RouteObject): void {\n const existingChildren = parentRoute.children || [];\n\n const newRoutes = resolvedRoutes.filter(\n newRoute =>\n !existingChildren.some(\n existing =>\n existing === newRoute ||\n (newRoute.path && existing.path === newRoute.path) ||\n (newRoute.id && existing.id === newRoute.id),\n ),\n );\n\n if (newRoutes.length > 0) {\n parentRoute.children = [...existingChildren, ...newRoutes];\n }\n}\n\nexport interface ReactRouterOptions {\n useEffect: UseEffect;\n useLocation: UseLocation;\n useNavigationType: UseNavigationType;\n createRoutesFromChildren: CreateRoutesFromChildren;\n matchRoutes: MatchRoutes;\n /**\n * Whether to strip the basename from the pathname when creating transactions.\n *\n * This is useful for applications that use a basename in their routing setup.\n * @default false\n */\n stripBasename?: boolean;\n /**\n * Enables support for async route handlers.\n *\n * This allows Sentry to track and instrument routes dynamically resolved from async handlers.\n * @default false\n */\n enableAsyncRouteHandlers?: boolean;\n}\n\ntype V6CompatibleVersion = '6' | '7';\n\n// Keeping as a global variable for cross-usage in multiple functions\nconst allRoutes = new Set<RouteObject>();\n\n/**\n * Processes resolved routes by adding them to allRoutes and checking for nested async handlers.\n */\nexport function processResolvedRoutes(\n resolvedRoutes: RouteObject[],\n parentRoute?: RouteObject,\n currentLocation: Location | null = null,\n): void {\n resolvedRoutes.forEach(child => {\n allRoutes.add(child);\n // Only check for async handlers if the feature is enabled\n if (_enableAsyncRouteHandlers) {\n checkRouteForAsyncHandler(child, processResolvedRoutes);\n }\n });\n\n if (parentRoute) {\n // If a parent route is provided, add the resolved routes as children to the parent route\n addResolvedRoutesToParent(resolvedRoutes, parentRoute);\n }\n\n // After processing lazy routes, check if we need to update an active transaction\n const activeRootSpan = getActiveRootSpan();\n if (activeRootSpan) {\n const spanOp = spanToJSON(activeRootSpan).op;\n\n // Try to use the provided location first, then fall back to global window location if needed\n let location = currentLocation;\n if (!location) {\n if (typeof WINDOW !== 'undefined') {\n const globalLocation = WINDOW.location;\n if (globalLocation) {\n location = { pathname: globalLocation.pathname };\n }\n }\n }\n\n if (location) {\n if (spanOp === 'pageload') {\n // Re-run the pageload transaction update with the newly loaded routes\n updatePageloadTransaction({\n activeRootSpan,\n location: { pathname: location.pathname },\n routes: Array.from(allRoutes),\n allRoutes: Array.from(allRoutes),\n });\n } else if (spanOp === 'navigation') {\n // For navigation spans, update the name with the newly loaded routes\n updateNavigationSpan(activeRootSpan, location, Array.from(allRoutes), false, _matchRoutes);\n }\n }\n }\n}\n\n/**\n * Updates a navigation span with the correct route name after lazy routes have been loaded.\n */\nexport function updateNavigationSpan(\n activeRootSpan: Span,\n location: Location,\n allRoutes: RouteObject[],\n forceUpdate = false,\n matchRoutes: MatchRoutes,\n): void {\n // Check if this span has already been named to avoid multiple updates\n // But allow updates if this is a forced update (e.g., when lazy routes are loaded)\n const hasBeenNamed =\n !forceUpdate &&\n (\n activeRootSpan as {\n __sentry_navigation_name_set__?: boolean;\n }\n )?.__sentry_navigation_name_set__;\n\n if (!hasBeenNamed) {\n // Get fresh branches for the current location with all loaded routes\n const currentBranches = matchRoutes(allRoutes, location);\n const [name, source] = resolveRouteNameAndSource(\n location,\n allRoutes,\n allRoutes,\n (currentBranches as RouteMatch[]) || [],\n '',\n );\n\n // Only update if we have a valid name and the span hasn't finished\n const spanJson = spanToJSON(activeRootSpan);\n if (name && !spanJson.timestamp) {\n activeRootSpan.updateName(name);\n activeRootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);\n\n // Mark this span as having its name set to prevent future updates\n addNonEnumerableProperty(\n activeRootSpan as { __sentry_navigation_name_set__?: boolean },\n '__sentry_navigation_name_set__',\n true,\n );\n }\n }\n}\n\n/**\n * Creates a wrapCreateBrowserRouter function that can be used with all React Router v6 compatible versions.\n */\nexport function createV6CompatibleWrapCreateBrowserRouter<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(\n createRouterFunction: CreateRouterFunction<TState, TRouter>,\n version: V6CompatibleVersion,\n): CreateRouterFunction<TState, TRouter> {\n if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes) {\n DEBUG_BUILD &&\n debug.warn(\n `reactRouterV${version}Instrumentation was unable to wrap the \\`createRouter\\` function because of one or more missing parameters.`,\n );\n\n return createRouterFunction;\n }\n\n return function (routes: RouteObject[], opts?: Record<string, unknown> & { basename?: string }): TRouter {\n addRoutesToAllRoutes(routes);\n\n // Check for async handlers that might contain sub-route declarations (only if enabled)\n if (_enableAsyncRouteHandlers) {\n for (const route of routes) {\n checkRouteForAsyncHandler(route, processResolvedRoutes);\n }\n }\n\n // Wrap patchRoutesOnNavigation to detect when lazy routes are loaded\n const wrappedOpts = wrapPatchRoutesOnNavigation(opts);\n\n const router = createRouterFunction(routes, wrappedOpts);\n const basename = opts?.basename;\n\n const activeRootSpan = getActiveRootSpan();\n\n // The initial load ends when `createBrowserRouter` is called.\n // This is the earliest convenient time to update the transaction name.\n // Callbacks to `router.subscribe` are not called for the initial load.\n if (router.state.historyAction === 'POP' && activeRootSpan) {\n updatePageloadTransaction({\n activeRootSpan,\n location: router.state.location,\n routes,\n basename,\n allRoutes: Array.from(allRoutes),\n });\n }\n\n router.subscribe((state: RouterState) => {\n if (state.historyAction === 'PUSH' || state.historyAction === 'POP') {\n // Wait for the next render if loading an unsettled route\n if (state.navigation.state !== 'idle') {\n requestAnimationFrame(() => {\n handleNavigation({\n location: state.location,\n routes,\n navigationType: state.historyAction,\n version,\n basename,\n allRoutes: Array.from(allRoutes),\n });\n });\n } else {\n handleNavigation({\n location: state.location,\n routes,\n navigationType: state.historyAction,\n version,\n basename,\n allRoutes: Array.from(allRoutes),\n });\n }\n }\n });\n\n return router;\n };\n}\n\n/**\n * Creates a wrapCreateMemoryRouter function that can be used with all React Router v6 compatible versions.\n */\nexport function createV6CompatibleWrapCreateMemoryRouter<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(\n createRouterFunction: CreateRouterFunction<TState, TRouter>,\n version: V6CompatibleVersion,\n): CreateRouterFunction<TState, TRouter> {\n if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes) {\n DEBUG_BUILD &&\n debug.warn(\n `reactRouterV${version}Instrumentation was unable to wrap the \\`createMemoryRouter\\` function because of one or more missing parameters.`,\n );\n\n return createRouterFunction;\n }\n\n return function (\n routes: RouteObject[],\n opts?: Record<string, unknown> & {\n basename?: string;\n initialEntries?: (string | { pathname: string })[];\n initialIndex?: number;\n },\n ): TRouter {\n addRoutesToAllRoutes(routes);\n\n // Check for async handlers that might contain sub-route declarations (only if enabled)\n if (_enableAsyncRouteHandlers) {\n for (const route of routes) {\n checkRouteForAsyncHandler(route, processResolvedRoutes);\n }\n }\n\n // Wrap patchRoutesOnNavigation to detect when lazy routes are loaded\n const wrappedOpts = wrapPatchRoutesOnNavigation(opts, true);\n\n const router = createRouterFunction(routes, wrappedOpts);\n const basename = opts?.basename;\n\n const activeRootSpan = getActiveRootSpan();\n let initialEntry = undefined;\n\n const initialEntries = opts?.initialEntries;\n const initialIndex = opts?.initialIndex;\n\n const hasOnlyOneInitialEntry = initialEntries && initialEntries.length === 1;\n const hasIndexedEntry = initialIndex !== undefined && initialEntries && initialEntries[initialIndex];\n\n initialEntry = hasOnlyOneInitialEntry\n ? initialEntries[0]\n : hasIndexedEntry\n ? initialEntries[initialIndex]\n : undefined;\n\n const location = initialEntry\n ? typeof initialEntry === 'string'\n ? { pathname: initialEntry }\n : initialEntry\n : router.state.location;\n\n if (router.state.historyAction === 'POP' && activeRootSpan) {\n updatePageloadTransaction({\n activeRootSpan,\n location,\n routes,\n basename,\n allRoutes: Array.from(allRoutes),\n });\n }\n\n router.subscribe((state: RouterState) => {\n const location = state.location;\n if (state.historyAction === 'PUSH' || state.historyAction === 'POP') {\n handleNavigation({\n location,\n routes,\n navigationType: state.historyAction,\n version,\n basename,\n allRoutes: Array.from(allRoutes),\n });\n }\n });\n\n return router;\n };\n}\n\n/**\n * Creates a browser tracing integration that can be used with all React Router v6 compatible versions.\n */\nexport function createReactRouterV6CompatibleTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n version: V6CompatibleVersion,\n): Integration {\n const integration = browserTracingIntegration({\n ...options,\n instrumentPageLoad: false,\n instrumentNavigation: false,\n });\n\n const {\n useEffect,\n useLocation,\n useNavigationType,\n createRoutesFromChildren,\n matchRoutes,\n stripBasename,\n enableAsyncRouteHandlers = false,\n instrumentPageLoad = true,\n instrumentNavigation = true,\n } = options;\n\n return {\n ...integration,\n setup(client) {\n integration.setup(client);\n\n _useEffect = useEffect;\n _useLocation = useLocation;\n _useNavigationType = useNavigationType;\n _matchRoutes = matchRoutes;\n _createRoutesFromChildren = createRoutesFromChildren;\n _enableAsyncRouteHandlers = enableAsyncRouteHandlers;\n\n // Initialize the router utils with the required dependencies\n initializeRouterUtils(matchRoutes, stripBasename || false);\n },\n afterAllSetup(client) {\n integration.afterAllSetup(client);\n\n const initPathName = WINDOW.location?.pathname;\n if (instrumentPageLoad && initPathName) {\n startBrowserTracingPageLoadSpan(client, {\n name: initPathName,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.pageload.react.reactrouter_v${version}`,\n },\n });\n }\n\n if (instrumentNavigation) {\n CLIENTS_WITH_INSTRUMENT_NAVIGATION.add(client);\n }\n },\n };\n}\n\nexport function createV6CompatibleWrapUseRoutes(origUseRoutes: UseRoutes, version: V6CompatibleVersion): UseRoutes {\n if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes) {\n DEBUG_BUILD &&\n debug.warn(\n 'reactRouterV6Instrumentation was unable to wrap `useRoutes` because of one or more missing parameters.',\n );\n\n return origUseRoutes;\n }\n\n const SentryRoutes: React.FC<{\n children?: React.ReactNode;\n routes: RouteObject[];\n locationArg?: Partial<Location> | string;\n }> = (props: { children?: React.ReactNode; routes: RouteObject[]; locationArg?: Partial<Location> | string }) => {\n const isMountRenderPass = React.useRef(true);\n const { routes, locationArg } = props;\n\n const Routes = origUseRoutes(routes, locationArg);\n\n const location = _useLocation();\n const navigationType = _useNavigationType();\n\n // A value with stable identity to either pick `locationArg` if available or `location` if not\n const stableLocationParam =\n typeof locationArg === 'string' || locationArg?.pathname ? (locationArg as { pathname: string }) : location;\n\n _useEffect(() => {\n const normalizedLocation =\n typeof stableLocationParam === 'string' ? { pathname: stableLocationParam } : stableLocationParam;\n\n if (isMountRenderPass.current) {\n addRoutesToAllRoutes(routes);\n\n updatePageloadTransaction({\n activeRootSpan: getActiveRootSpan(),\n location: normalizedLocation,\n routes,\n allRoutes: Array.from(allRoutes),\n });\n isMountRenderPass.current = false;\n } else {\n handleNavigation({\n location: normalizedLocation,\n routes,\n navigationType,\n version,\n allRoutes: Array.from(allRoutes),\n });\n }\n }, [navigationType, stableLocationParam]);\n\n return Routes;\n };\n\n // eslint-disable-next-line react/display-name\n return (routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null => {\n return <SentryRoutes routes={routes} locationArg={locationArg} />;\n };\n}\n\nfunction wrapPatchRoutesOnNavigation(\n opts: Record<string, unknown> | undefined,\n isMemoryRouter = false,\n): Record<string, unknown> {\n if (!opts || !('patchRoutesOnNavigation' in opts) || typeof opts.patchRoutesOnNavigation !== 'function') {\n return opts || {};\n }\n\n const originalPatchRoutes = opts.patchRoutesOnNavigation;\n return {\n ...opts,\n patchRoutesOnNavigation: async (args: unknown) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n const targetPath = (args as any)?.path;\n\n // For browser router, wrap the patch function to update span during patching\n if (!isMemoryRouter) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n const originalPatch = (args as any)?.patch;\n if (originalPatch) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n (args as any).patch = (routeId: string, children: RouteObject[]) => {\n addRoutesToAllRoutes(children);\n const activeRootSpan = getActiveRootSpan();\n if (activeRootSpan && (spanToJSON(activeRootSpan) as { op?: string }).op === 'navigation') {\n updateNavigationSpan(\n activeRootSpan,\n {\n pathname: targetPath,\n search: '',\n hash: '',\n state: null,\n key: 'default',\n },\n Array.from(allRoutes),\n true, // forceUpdate = true since we're loading lazy routes\n _matchRoutes,\n );\n }\n return originalPatch(routeId, children);\n };\n }\n }\n\n const result = await originalPatchRoutes(args);\n\n // Update navigation span after routes are patched\n const activeRootSpan = getActiveRootSpan();\n if (activeRootSpan && (spanToJSON(activeRootSpan) as { op?: string }).op === 'navigation') {\n // For memory routers, we should not access window.location; use targetPath only\n const pathname = isMemoryRouter ? targetPath : targetPath || WINDOW.location?.pathname;\n if (pathname) {\n updateNavigationSpan(\n activeRootSpan,\n {\n pathname,\n search: '',\n hash: '',\n state: null,\n key: 'default',\n },\n Array.from(allRoutes),\n false, // forceUpdate = false since this is after lazy routes are loaded\n _matchRoutes,\n );\n }\n }\n\n return result;\n },\n };\n}\n\nexport function handleNavigation(opts: {\n location: Location;\n routes: RouteObject[];\n navigationType: Action;\n version: V6CompatibleVersion;\n matches?: AgnosticDataRouteMatch;\n basename?: string;\n allRoutes?: RouteObject[];\n}): void {\n const { location, routes, navigationType, version, matches, basename, allRoutes } = opts;\n const branches = Array.isArray(matches) ? matches : _matchRoutes(routes, location, basename);\n\n const client = getClient();\n if (!client || !CLIENTS_WITH_INSTRUMENT_NAVIGATION.has(client)) {\n return;\n }\n\n if ((navigationType === 'PUSH' || navigationType === 'POP') && branches) {\n const [name, source] = resolveRouteNameAndSource(\n location,\n routes,\n allRoutes || routes,\n branches as RouteMatch[],\n basename,\n );\n\n // Check if this might be a lazy route context\n const isLazyRouteContext = isLikelyLazyRouteContext(allRoutes || routes, location);\n\n const activeSpan = getActiveSpan();\n const spanJson = activeSpan && spanToJSON(activeSpan);\n const isAlreadyInNavigationSpan = spanJson?.op === 'navigation';\n\n // Cross usage can result in multiple navigation spans being created without this check\n if (isAlreadyInNavigationSpan && activeSpan && spanJson) {\n handleExistingNavigationSpan(activeSpan, spanJson, name, source, isLazyRouteContext);\n } else {\n createNewNavigationSpan(client, name, source, version, isLazyRouteContext);\n }\n }\n}\n\nfunction addRoutesToAllRoutes(routes: RouteObject[]): void {\n routes.forEach(route => {\n const extractedChildRoutes = getChildRoutesRecursively(route);\n\n extractedChildRoutes.forEach(r => {\n allRoutes.add(r);\n });\n });\n}\n\nfunction getChildRoutesRecursively(route: RouteObject, allRoutes: Set<RouteObject> = new Set()): Set<RouteObject> {\n if (!allRoutes.has(route)) {\n allRoutes.add(route);\n\n if (route.children && !route.index) {\n route.children.forEach(child => {\n const childRoutes = getChildRoutesRecursively(child, allRoutes);\n\n childRoutes.forEach(r => {\n allRoutes.add(r);\n });\n });\n }\n }\n\n return allRoutes;\n}\n\nfunction updatePageloadTransaction({\n activeRootSpan,\n location,\n routes,\n matches,\n basename,\n allRoutes,\n}: {\n activeRootSpan: Span | undefined;\n location: Location;\n routes: RouteObject[];\n matches?: AgnosticDataRouteMatch;\n basename?: string;\n allRoutes?: RouteObject[];\n}): void {\n const branches = Array.isArray(matches)\n ? matches\n : (_matchRoutes(allRoutes || routes, location, basename) as unknown as RouteMatch[]);\n\n if (branches) {\n let name,\n source: TransactionSource = 'url';\n\n const isInDescendantRoute = locationIsInsideDescendantRoute(location, allRoutes || routes);\n\n if (isInDescendantRoute) {\n name = prefixWithSlash(rebuildRoutePathFromAllRoutes(allRoutes || routes, location));\n source = 'route';\n }\n\n if (!isInDescendantRoute || !name) {\n [name, source] = getNormalizedName(routes, location, branches, basename);\n }\n\n getCurrentScope().setTransactionName(name || '/');\n\n if (activeRootSpan) {\n activeRootSpan.updateName(name);\n activeRootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);\n }\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function createV6CompatibleWithSentryReactRouterRouting<P extends Record<string, any>, R extends React.FC<P>>(\n Routes: R,\n version: V6CompatibleVersion,\n): R {\n if (!_useEffect || !_useLocation || !_useNavigationType || !_createRoutesFromChildren || !_matchRoutes) {\n DEBUG_BUILD &&\n debug.warn(`reactRouterV6Instrumentation was unable to wrap Routes because of one or more missing parameters.\n useEffect: ${_useEffect}. useLocation: ${_useLocation}. useNavigationType: ${_useNavigationType}.\n createRoutesFromChildren: ${_createRoutesFromChildren}. matchRoutes: ${_matchRoutes}.`);\n\n return Routes;\n }\n\n const SentryRoutes: React.FC<P> = (props: P) => {\n const isMountRenderPass = React.useRef(true);\n\n const location = _useLocation();\n const navigationType = _useNavigationType();\n\n _useEffect(\n () => {\n const routes = _createRoutesFromChildren(props.children) as RouteObject[];\n\n if (isMountRenderPass.current) {\n addRoutesToAllRoutes(routes);\n\n updatePageloadTransaction({\n activeRootSpan: getActiveRootSpan(),\n location,\n routes,\n allRoutes: Array.from(allRoutes),\n });\n isMountRenderPass.current = false;\n } else {\n handleNavigation({\n location,\n routes,\n navigationType,\n version,\n allRoutes: Array.from(allRoutes),\n });\n }\n },\n // `props.children` is purposely not included in the dependency array, because we do not want to re-run this effect\n // when the children change. We only want to start transactions when the location or navigation type change.\n [location, navigationType],\n );\n\n // @ts-expect-error Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params\n return <Routes {...props} />;\n };\n\n hoistNonReactStatics(SentryRoutes, Routes);\n\n // @ts-expect-error Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params\n return SentryRoutes;\n}\n\nfunction getActiveRootSpan(): Span | undefined {\n const span = getActiveSpan();\n const rootSpan = span ? getRootSpan(span) : undefined;\n\n if (!rootSpan) {\n return undefined;\n }\n\n const op = spanToJSON(rootSpan).op;\n\n // Only use this root span if it is a pageload or navigation span\n return op === 'navigation' || op === 'pageload' ? rootSpan : undefined;\n}\n\n/**\n * Handles updating an existing navigation span\n */\nexport function handleExistingNavigationSpan(\n activeSpan: Span,\n spanJson: ReturnType<typeof spanToJSON>,\n name: string,\n source: TransactionSource,\n isLikelyLazyRoute: boolean,\n): void {\n // Check if we've already set the name for this span using a custom property\n const hasBeenNamed = (\n activeSpan as {\n __sentry_navigation_name_set__?: boolean;\n }\n )?.__sentry_navigation_name_set__;\n\n if (!hasBeenNamed) {\n // This is the first time we're setting the name for this span\n if (!spanJson.timestamp) {\n activeSpan?.updateName(name);\n }\n\n // For lazy routes, don't mark as named yet so it can be updated later\n if (!isLikelyLazyRoute) {\n addNonEnumerableProperty(\n activeSpan as { __sentry_navigation_name_set__?: boolean },\n '__sentry_navigation_name_set__',\n true,\n );\n }\n }\n\n // Always set the source attribute to keep it consistent with the current route\n activeSpan?.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);\n}\n\n/**\n * Creates a new navigation span\n */\nexport function createNewNavigationSpan(\n client: Client,\n name: string,\n source: TransactionSource,\n version: string,\n isLikelyLazyRoute: boolean,\n): void {\n const newSpan = startBrowserTracingNavigationSpan(client, {\n name,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.navigation.react.reactrouter_v${version}`,\n },\n });\n\n // For lazy routes, don't mark as named yet so it can be updated later when the route loads\n if (!isLikelyLazyRoute && newSpan) {\n addNonEnumerableProperty(\n newSpan as { __sentry_navigation_name_set__?: boolean },\n '__sentry_navigation_name_set__',\n true,\n );\n }\n}\n"],"names":["checkRouteForAsyncHandler","spanToJSON","WINDOW","resolveRouteNameAndSource","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","addNonEnumerableProperty","DEBUG_BUILD","debug","browserTracingIntegration","initializeRouterUtils","startBrowserTracingPageLoadSpan","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","getClient","isLikelyLazyRouteContext","getActiveSpan","locationIsInsideDescendantRoute","prefixWithSlash","rebuildRoutePathFromAllRoutes","getNormalizedName","getCurrentScope","hoistNonReactStatics","getRootSpan","startBrowserTracingNavigationSpan"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;;;AAmDA,IAAI,UAAU;AACd,IAAI,YAAY;AAChB,IAAI,kBAAkB;AACtB,IAAI,yBAAyB;AAC7B,IAAI,YAAY;AAChB,IAAI,yBAAyB,GAAY,KAAK;;AAE9C,MAAM,kCAAA,GAAqC,IAAI,OAAO,EAAU;;AAEhE;AACA;AACA;AACA;AACO,SAAS,yBAAyB,CAAC,cAAc,EAAiB,WAAW,EAAqB;AACzG,EAAE,MAAM,mBAAmB,WAAW,CAAC,QAAA,IAAY,EAAE;;AAErD,EAAE,MAAM,SAAA,GAAY,cAAc,CAAC,MAAM;AACzC,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AEA;AACA,EAAA,UAAA,EAAA,YAAA,CAAAD,qCAAA,EAAA,MAAA,CAAA;AACA;;AAEA;AACA;AACA;AACA,SAAA,uBAAA;AACA,EAAA,MAAA;AACA,EAAA,IAAA;AACA,EAAA,MAAA;AACA,EAAA,OAAA;AACA,EAAA,iBAAA;AACA,EAAA;AACA,EAAA,MAAA,OAAA,GAAAmB,yCAAA,CAAA,MAAA,EAAA;AACA,IAAA,IAAA;AACA,IAAA,UAAA,EAAA;AACA,MAAA,CAAAnB,qCAAA,GAAA,MAAA;AACA,MAAA,CAAAO,iCAAA,GAAA,YAAA;AACA,MAAA,CAAAC,qCAAA,GAAA,CAAA,mCAAA,EAAA,OAAA,CAAA,CAAA;AACA,KAAA;AACA,GAAA,CAAA;;AAEA;AACA,EAAA,IAAA,CAAA,iBAAA,IAAA,OAAA,EAAA;AACA,IAAAP,6BAAA;AACA,MAAA,OAAA;AACA,MAAA,gCAAA;AACA,MAAA,IAAA;AACA,KAAA;AACA;AACA;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sources":["../../../src/reactrouter-compat-utils/instrumentation.tsx"],"sourcesContent":["/* eslint-disable max-lines */\n// Inspired from Donnie McNeal's solution:\n// https://gist.github.com/wontondon/e8c4bdf2888875e4c755712e99279536\n\nimport {\n browserTracingIntegration,\n startBrowserTracingNavigationSpan,\n startBrowserTracingPageLoadSpan,\n WINDOW,\n} from '@sentry/browser';\nimport type { Client, Integration, Span, TransactionSource } from '@sentry/core';\nimport {\n addNonEnumerableProperty,\n debug,\n getActiveSpan,\n getClient,\n getCurrentScope,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n spanToJSON,\n} from '@sentry/core';\nimport * as React from 'react';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { hoistNonReactStatics } from '../hoist-non-react-statics';\nimport type {\n Action,\n AgnosticDataRouteMatch,\n CreateRouterFunction,\n CreateRoutesFromChildren,\n Location,\n MatchRoutes,\n RouteMatch,\n RouteObject,\n Router,\n RouterState,\n UseEffect,\n UseLocation,\n UseNavigationType,\n UseRoutes,\n} from '../types';\nimport { checkRouteForAsyncHandler } from './lazy-routes';\nimport {\n getNormalizedName,\n initializeRouterUtils,\n locationIsInsideDescendantRoute,\n prefixWithSlash,\n rebuildRoutePathFromAllRoutes,\n resolveRouteNameAndSource,\n} from './utils';\n\nlet _useEffect: UseEffect;\nlet _useLocation: UseLocation;\nlet _useNavigationType: UseNavigationType;\nlet _createRoutesFromChildren: CreateRoutesFromChildren;\nlet _matchRoutes: MatchRoutes;\nlet _enableAsyncRouteHandlers: boolean = false;\n\nconst CLIENTS_WITH_INSTRUMENT_NAVIGATION = new WeakSet<Client>();\n\n/**\n * Adds resolved routes as children to the parent route.\n * Prevents duplicate routes by checking if they already exist.\n */\nexport function addResolvedRoutesToParent(resolvedRoutes: RouteObject[], parentRoute: RouteObject): void {\n const existingChildren = parentRoute.children || [];\n\n const newRoutes = resolvedRoutes.filter(\n newRoute =>\n !existingChildren.some(\n existing =>\n existing === newRoute ||\n (newRoute.path && existing.path === newRoute.path) ||\n (newRoute.id && existing.id === newRoute.id),\n ),\n );\n\n if (newRoutes.length > 0) {\n parentRoute.children = [...existingChildren, ...newRoutes];\n }\n}\n\nexport interface ReactRouterOptions {\n useEffect: UseEffect;\n useLocation: UseLocation;\n useNavigationType: UseNavigationType;\n createRoutesFromChildren: CreateRoutesFromChildren;\n matchRoutes: MatchRoutes;\n /**\n * Whether to strip the basename from the pathname when creating transactions.\n *\n * This is useful for applications that use a basename in their routing setup.\n * @default false\n */\n stripBasename?: boolean;\n /**\n * Enables support for async route handlers.\n *\n * This allows Sentry to track and instrument routes dynamically resolved from async handlers.\n * @default false\n */\n enableAsyncRouteHandlers?: boolean;\n}\n\ntype V6CompatibleVersion = '6' | '7';\n\n// Keeping as a global variable for cross-usage in multiple functions\nconst allRoutes = new Set<RouteObject>();\n\n/**\n * Processes resolved routes by adding them to allRoutes and checking for nested async handlers.\n */\nexport function processResolvedRoutes(\n resolvedRoutes: RouteObject[],\n parentRoute?: RouteObject,\n currentLocation: Location | null = null,\n): void {\n resolvedRoutes.forEach(child => {\n allRoutes.add(child);\n // Only check for async handlers if the feature is enabled\n if (_enableAsyncRouteHandlers) {\n checkRouteForAsyncHandler(child, processResolvedRoutes);\n }\n });\n\n if (parentRoute) {\n // If a parent route is provided, add the resolved routes as children to the parent route\n addResolvedRoutesToParent(resolvedRoutes, parentRoute);\n }\n\n // After processing lazy routes, check if we need to update an active transaction\n const activeRootSpan = getActiveRootSpan();\n if (activeRootSpan) {\n const spanOp = spanToJSON(activeRootSpan).op;\n\n // Try to use the provided location first, then fall back to global window location if needed\n let location = currentLocation;\n if (!location) {\n if (typeof WINDOW !== 'undefined') {\n const globalLocation = WINDOW.location;\n if (globalLocation) {\n location = { pathname: globalLocation.pathname };\n }\n }\n }\n\n if (location) {\n if (spanOp === 'pageload') {\n // Re-run the pageload transaction update with the newly loaded routes\n updatePageloadTransaction({\n activeRootSpan,\n location: { pathname: location.pathname },\n routes: Array.from(allRoutes),\n allRoutes: Array.from(allRoutes),\n });\n } else if (spanOp === 'navigation') {\n // For navigation spans, update the name with the newly loaded routes\n updateNavigationSpan(activeRootSpan, location, Array.from(allRoutes), false, _matchRoutes);\n }\n }\n }\n}\n\n/**\n * Updates a navigation span with the correct route name after lazy routes have been loaded.\n */\nexport function updateNavigationSpan(\n activeRootSpan: Span,\n location: Location,\n allRoutes: RouteObject[],\n forceUpdate = false,\n matchRoutes: MatchRoutes,\n): void {\n // Check if this span has already been named to avoid multiple updates\n // But allow updates if this is a forced update (e.g., when lazy routes are loaded)\n const hasBeenNamed =\n !forceUpdate && (activeRootSpan as { __sentry_navigation_name_set__?: boolean })?.__sentry_navigation_name_set__;\n\n if (!hasBeenNamed) {\n // Get fresh branches for the current location with all loaded routes\n const currentBranches = matchRoutes(allRoutes, location);\n const [name, source] = resolveRouteNameAndSource(\n location,\n allRoutes,\n allRoutes,\n (currentBranches as RouteMatch[]) || [],\n '',\n );\n\n // Only update if we have a valid name and the span hasn't finished\n const spanJson = spanToJSON(activeRootSpan);\n if (name && !spanJson.timestamp) {\n activeRootSpan.updateName(name);\n activeRootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);\n\n // Mark this span as having its name set to prevent future updates\n addNonEnumerableProperty(\n activeRootSpan as { __sentry_navigation_name_set__?: boolean },\n '__sentry_navigation_name_set__',\n true,\n );\n }\n }\n}\n\n/**\n * Creates a wrapCreateBrowserRouter function that can be used with all React Router v6 compatible versions.\n */\nexport function createV6CompatibleWrapCreateBrowserRouter<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(\n createRouterFunction: CreateRouterFunction<TState, TRouter>,\n version: V6CompatibleVersion,\n): CreateRouterFunction<TState, TRouter> {\n if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes) {\n DEBUG_BUILD &&\n debug.warn(\n `reactRouterV${version}Instrumentation was unable to wrap the \\`createRouter\\` function because of one or more missing parameters.`,\n );\n\n return createRouterFunction;\n }\n\n return function (routes: RouteObject[], opts?: Record<string, unknown> & { basename?: string }): TRouter {\n addRoutesToAllRoutes(routes);\n\n // Check for async handlers that might contain sub-route declarations (only if enabled)\n if (_enableAsyncRouteHandlers) {\n for (const route of routes) {\n checkRouteForAsyncHandler(route, processResolvedRoutes);\n }\n }\n\n // Wrap patchRoutesOnNavigation to detect when lazy routes are loaded\n const wrappedOpts = wrapPatchRoutesOnNavigation(opts);\n\n const router = createRouterFunction(routes, wrappedOpts);\n const basename = opts?.basename;\n\n const activeRootSpan = getActiveRootSpan();\n\n // The initial load ends when `createBrowserRouter` is called.\n // This is the earliest convenient time to update the transaction name.\n // Callbacks to `router.subscribe` are not called for the initial load.\n if (router.state.historyAction === 'POP' && activeRootSpan) {\n updatePageloadTransaction({\n activeRootSpan,\n location: router.state.location,\n routes,\n basename,\n allRoutes: Array.from(allRoutes),\n });\n }\n\n router.subscribe((state: RouterState) => {\n if (state.historyAction === 'PUSH' || state.historyAction === 'POP') {\n // Wait for the next render if loading an unsettled route\n if (state.navigation.state !== 'idle') {\n requestAnimationFrame(() => {\n handleNavigation({\n location: state.location,\n routes,\n navigationType: state.historyAction,\n version,\n basename,\n allRoutes: Array.from(allRoutes),\n });\n });\n } else {\n handleNavigation({\n location: state.location,\n routes,\n navigationType: state.historyAction,\n version,\n basename,\n allRoutes: Array.from(allRoutes),\n });\n }\n }\n });\n\n return router;\n };\n}\n\n/**\n * Creates a wrapCreateMemoryRouter function that can be used with all React Router v6 compatible versions.\n */\nexport function createV6CompatibleWrapCreateMemoryRouter<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(\n createRouterFunction: CreateRouterFunction<TState, TRouter>,\n version: V6CompatibleVersion,\n): CreateRouterFunction<TState, TRouter> {\n if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes) {\n DEBUG_BUILD &&\n debug.warn(\n `reactRouterV${version}Instrumentation was unable to wrap the \\`createMemoryRouter\\` function because of one or more missing parameters.`,\n );\n\n return createRouterFunction;\n }\n\n return function (\n routes: RouteObject[],\n opts?: Record<string, unknown> & {\n basename?: string;\n initialEntries?: (string | { pathname: string })[];\n initialIndex?: number;\n },\n ): TRouter {\n addRoutesToAllRoutes(routes);\n\n // Check for async handlers that might contain sub-route declarations (only if enabled)\n if (_enableAsyncRouteHandlers) {\n for (const route of routes) {\n checkRouteForAsyncHandler(route, processResolvedRoutes);\n }\n }\n\n // Wrap patchRoutesOnNavigation to detect when lazy routes are loaded\n const wrappedOpts = wrapPatchRoutesOnNavigation(opts, true);\n\n const router = createRouterFunction(routes, wrappedOpts);\n const basename = opts?.basename;\n\n const activeRootSpan = getActiveRootSpan();\n let initialEntry = undefined;\n\n const initialEntries = opts?.initialEntries;\n const initialIndex = opts?.initialIndex;\n\n const hasOnlyOneInitialEntry = initialEntries && initialEntries.length === 1;\n const hasIndexedEntry = initialIndex !== undefined && initialEntries && initialEntries[initialIndex];\n\n initialEntry = hasOnlyOneInitialEntry\n ? initialEntries[0]\n : hasIndexedEntry\n ? initialEntries[initialIndex]\n : undefined;\n\n const location = initialEntry\n ? typeof initialEntry === 'string'\n ? { pathname: initialEntry }\n : initialEntry\n : router.state.location;\n\n if (router.state.historyAction === 'POP' && activeRootSpan) {\n updatePageloadTransaction({ activeRootSpan, location, routes, basename, allRoutes: Array.from(allRoutes) });\n }\n\n router.subscribe((state: RouterState) => {\n const location = state.location;\n if (state.historyAction === 'PUSH' || state.historyAction === 'POP') {\n handleNavigation({\n location,\n routes,\n navigationType: state.historyAction,\n version,\n basename,\n allRoutes: Array.from(allRoutes),\n });\n }\n });\n\n return router;\n };\n}\n\n/**\n * Creates a browser tracing integration that can be used with all React Router v6 compatible versions.\n */\nexport function createReactRouterV6CompatibleTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n version: V6CompatibleVersion,\n): Integration {\n const integration = browserTracingIntegration({ ...options, instrumentPageLoad: false, instrumentNavigation: false });\n\n const {\n useEffect,\n useLocation,\n useNavigationType,\n createRoutesFromChildren,\n matchRoutes,\n stripBasename,\n enableAsyncRouteHandlers = false,\n instrumentPageLoad = true,\n instrumentNavigation = true,\n } = options;\n\n return {\n ...integration,\n setup(client) {\n integration.setup(client);\n\n _useEffect = useEffect;\n _useLocation = useLocation;\n _useNavigationType = useNavigationType;\n _matchRoutes = matchRoutes;\n _createRoutesFromChildren = createRoutesFromChildren;\n _enableAsyncRouteHandlers = enableAsyncRouteHandlers;\n\n // Initialize the router utils with the required dependencies\n initializeRouterUtils(matchRoutes, stripBasename || false);\n },\n afterAllSetup(client) {\n integration.afterAllSetup(client);\n\n const initPathName = WINDOW.location?.pathname;\n if (instrumentPageLoad && initPathName) {\n startBrowserTracingPageLoadSpan(client, {\n name: initPathName,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.pageload.react.reactrouter_v${version}`,\n },\n });\n }\n\n if (instrumentNavigation) {\n CLIENTS_WITH_INSTRUMENT_NAVIGATION.add(client);\n }\n },\n };\n}\n\nexport function createV6CompatibleWrapUseRoutes(origUseRoutes: UseRoutes, version: V6CompatibleVersion): UseRoutes {\n if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes) {\n DEBUG_BUILD &&\n debug.warn(\n 'reactRouterV6Instrumentation was unable to wrap `useRoutes` because of one or more missing parameters.',\n );\n\n return origUseRoutes;\n }\n\n const SentryRoutes: React.FC<{\n children?: React.ReactNode;\n routes: RouteObject[];\n locationArg?: Partial<Location> | string;\n }> = (props: { children?: React.ReactNode; routes: RouteObject[]; locationArg?: Partial<Location> | string }) => {\n const isMountRenderPass = React.useRef(true);\n const { routes, locationArg } = props;\n\n const Routes = origUseRoutes(routes, locationArg);\n\n const location = _useLocation();\n const navigationType = _useNavigationType();\n\n // A value with stable identity to either pick `locationArg` if available or `location` if not\n const stableLocationParam =\n typeof locationArg === 'string' || locationArg?.pathname ? (locationArg as { pathname: string }) : location;\n\n _useEffect(() => {\n const normalizedLocation =\n typeof stableLocationParam === 'string' ? { pathname: stableLocationParam } : stableLocationParam;\n\n if (isMountRenderPass.current) {\n addRoutesToAllRoutes(routes);\n\n updatePageloadTransaction({\n activeRootSpan: getActiveRootSpan(),\n location: normalizedLocation,\n routes,\n allRoutes: Array.from(allRoutes),\n });\n isMountRenderPass.current = false;\n } else {\n handleNavigation({\n location: normalizedLocation,\n routes,\n navigationType,\n version,\n allRoutes: Array.from(allRoutes),\n });\n }\n }, [navigationType, stableLocationParam]);\n\n return Routes;\n };\n\n // eslint-disable-next-line react/display-name\n return (routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null => {\n return <SentryRoutes routes={routes} locationArg={locationArg} />;\n };\n}\n\nfunction wrapPatchRoutesOnNavigation(\n opts: Record<string, unknown> | undefined,\n isMemoryRouter = false,\n): Record<string, unknown> {\n if (!opts || !('patchRoutesOnNavigation' in opts) || typeof opts.patchRoutesOnNavigation !== 'function') {\n return opts || {};\n }\n\n const originalPatchRoutes = opts.patchRoutesOnNavigation;\n return {\n ...opts,\n patchRoutesOnNavigation: async (args: unknown) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n const targetPath = (args as any)?.path;\n\n // For browser router, wrap the patch function to update span during patching\n if (!isMemoryRouter) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n const originalPatch = (args as any)?.patch;\n if (originalPatch) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n (args as any).patch = (routeId: string, children: RouteObject[]) => {\n addRoutesToAllRoutes(children);\n const activeRootSpan = getActiveRootSpan();\n if (activeRootSpan && (spanToJSON(activeRootSpan) as { op?: string }).op === 'navigation') {\n updateNavigationSpan(\n activeRootSpan,\n { pathname: targetPath, search: '', hash: '', state: null, key: 'default' },\n Array.from(allRoutes),\n true, // forceUpdate = true since we're loading lazy routes\n _matchRoutes,\n );\n }\n return originalPatch(routeId, children);\n };\n }\n }\n\n const result = await originalPatchRoutes(args);\n\n // Update navigation span after routes are patched\n const activeRootSpan = getActiveRootSpan();\n if (activeRootSpan && (spanToJSON(activeRootSpan) as { op?: string }).op === 'navigation') {\n // For memory routers, we should not access window.location; use targetPath only\n const pathname = isMemoryRouter ? targetPath : targetPath || WINDOW.location?.pathname;\n if (pathname) {\n updateNavigationSpan(\n activeRootSpan,\n { pathname, search: '', hash: '', state: null, key: 'default' },\n Array.from(allRoutes),\n false, // forceUpdate = false since this is after lazy routes are loaded\n _matchRoutes,\n );\n }\n }\n\n return result;\n },\n };\n}\n\nexport function handleNavigation(opts: {\n location: Location;\n routes: RouteObject[];\n navigationType: Action;\n version: V6CompatibleVersion;\n matches?: AgnosticDataRouteMatch;\n basename?: string;\n allRoutes?: RouteObject[];\n}): void {\n const { location, routes, navigationType, version, matches, basename, allRoutes } = opts;\n const branches = Array.isArray(matches) ? matches : _matchRoutes(routes, location, basename);\n\n const client = getClient();\n if (!client || !CLIENTS_WITH_INSTRUMENT_NAVIGATION.has(client)) {\n return;\n }\n\n if ((navigationType === 'PUSH' || navigationType === 'POP') && branches) {\n const [name, source] = resolveRouteNameAndSource(\n location,\n routes,\n allRoutes || routes,\n branches as RouteMatch[],\n basename,\n );\n\n const activeSpan = getActiveSpan();\n const spanJson = activeSpan && spanToJSON(activeSpan);\n const isAlreadyInNavigationSpan = spanJson?.op === 'navigation';\n\n // Cross usage can result in multiple navigation spans being created without this check\n if (!isAlreadyInNavigationSpan) {\n startBrowserTracingNavigationSpan(client, {\n name,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.navigation.react.reactrouter_v${version}`,\n },\n });\n }\n }\n}\n\nfunction addRoutesToAllRoutes(routes: RouteObject[]): void {\n routes.forEach(route => {\n const extractedChildRoutes = getChildRoutesRecursively(route);\n\n extractedChildRoutes.forEach(r => {\n allRoutes.add(r);\n });\n });\n}\n\nfunction getChildRoutesRecursively(route: RouteObject, allRoutes: Set<RouteObject> = new Set()): Set<RouteObject> {\n if (!allRoutes.has(route)) {\n allRoutes.add(route);\n\n if (route.children && !route.index) {\n route.children.forEach(child => {\n const childRoutes = getChildRoutesRecursively(child, allRoutes);\n\n childRoutes.forEach(r => {\n allRoutes.add(r);\n });\n });\n }\n }\n\n return allRoutes;\n}\n\nfunction updatePageloadTransaction({\n activeRootSpan,\n location,\n routes,\n matches,\n basename,\n allRoutes,\n}: {\n activeRootSpan: Span | undefined;\n location: Location;\n routes: RouteObject[];\n matches?: AgnosticDataRouteMatch;\n basename?: string;\n allRoutes?: RouteObject[];\n}): void {\n const branches = Array.isArray(matches)\n ? matches\n : (_matchRoutes(allRoutes || routes, location, basename) as unknown as RouteMatch[]);\n\n if (branches) {\n let name,\n source: TransactionSource = 'url';\n\n const isInDescendantRoute = locationIsInsideDescendantRoute(location, allRoutes || routes);\n\n if (isInDescendantRoute) {\n name = prefixWithSlash(rebuildRoutePathFromAllRoutes(allRoutes || routes, location));\n source = 'route';\n }\n\n if (!isInDescendantRoute || !name) {\n [name, source] = getNormalizedName(routes, location, branches, basename);\n }\n\n getCurrentScope().setTransactionName(name || '/');\n\n if (activeRootSpan) {\n activeRootSpan.updateName(name);\n activeRootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);\n }\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function createV6CompatibleWithSentryReactRouterRouting<P extends Record<string, any>, R extends React.FC<P>>(\n Routes: R,\n version: V6CompatibleVersion,\n): R {\n if (!_useEffect || !_useLocation || !_useNavigationType || !_createRoutesFromChildren || !_matchRoutes) {\n DEBUG_BUILD &&\n debug.warn(`reactRouterV6Instrumentation was unable to wrap Routes because of one or more missing parameters.\n useEffect: ${_useEffect}. useLocation: ${_useLocation}. useNavigationType: ${_useNavigationType}.\n createRoutesFromChildren: ${_createRoutesFromChildren}. matchRoutes: ${_matchRoutes}.`);\n\n return Routes;\n }\n\n const SentryRoutes: React.FC<P> = (props: P) => {\n const isMountRenderPass = React.useRef(true);\n\n const location = _useLocation();\n const navigationType = _useNavigationType();\n\n _useEffect(\n () => {\n const routes = _createRoutesFromChildren(props.children) as RouteObject[];\n\n if (isMountRenderPass.current) {\n addRoutesToAllRoutes(routes);\n\n updatePageloadTransaction({\n activeRootSpan: getActiveRootSpan(),\n location,\n routes,\n allRoutes: Array.from(allRoutes),\n });\n isMountRenderPass.current = false;\n } else {\n handleNavigation({ location, routes, navigationType, version, allRoutes: Array.from(allRoutes) });\n }\n },\n // `props.children` is purposely not included in the dependency array, because we do not want to re-run this effect\n // when the children change. We only want to start transactions when the location or navigation type change.\n [location, navigationType],\n );\n\n // @ts-expect-error Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params\n return <Routes {...props} />;\n };\n\n hoistNonReactStatics(SentryRoutes, Routes);\n\n // @ts-expect-error Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params\n return SentryRoutes;\n}\n\nfunction getActiveRootSpan(): Span | undefined {\n const span = getActiveSpan();\n const rootSpan = span ? getRootSpan(span) : undefined;\n\n if (!rootSpan) {\n return undefined;\n }\n\n const op = spanToJSON(rootSpan).op;\n\n // Only use this root span if it is a pageload or navigation span\n return op === 'navigation' || op === 'pageload' ? rootSpan : undefined;\n}\n"],"names":["checkRouteForAsyncHandler","spanToJSON","WINDOW","resolveRouteNameAndSource","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","addNonEnumerableProperty","DEBUG_BUILD","debug","browserTracingIntegration","initializeRouterUtils","startBrowserTracingPageLoadSpan","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","getClient","getActiveSpan","startBrowserTracingNavigationSpan","locationIsInsideDescendantRoute","prefixWithSlash","rebuildRoutePathFromAllRoutes","getNormalizedName","getCurrentScope","hoistNonReactStatics","getRootSpan"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;;;AAkDA,IAAI,UAAU;AACd,IAAI,YAAY;AAChB,IAAI,kBAAkB;AACtB,IAAI,yBAAyB;AAC7B,IAAI,YAAY;AAChB,IAAI,yBAAyB,GAAY,KAAK;;AAE9C,MAAM,kCAAA,GAAqC,IAAI,OAAO,EAAU;;AAEhE;AACA;AACA;AACA;AACO,SAAS,yBAAyB,CAAC,cAAc,EAAiB,WAAW,EAAqB;AACzG,EAAE,MAAM,mBAAmB,WAAW,CAAC,QAAA,IAAY,EAAE;;AAErD,EAAE,MAAM,SAAA,GAAY,cAAc,CAAC,MAAM;AACz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KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAA,GAAA,KAAA,EAAA,EAAA;AACA,GAAA;;AAEA,EAAAc,yCAAA,CAAA,YAAA,EAAA,MAAA,CAAA;;AAEA;AACA;AACA,EAAA,OAAA,YAAA;AACA;;AAEA,SAAA,iBAAA,GAAA;AACA,EAAA,MAAA,IAAA,GAAAP,kBAAA,EAAA;AACA,EAAA,MAAA,QAAA,GAAA,IAAA,GAAAQ,gBAAA,CAAA,IAAA,CAAA,GAAA,SAAA;;AAEA,EAAA,IAAA,CAAA,QAAA,EAAA;AACA,IAAA,OAAA,SAAA;AACA;;AAEA,EAAA,MAAA,EAAA,GAAArB,eAAA,CAAA,QAAA,CAAA,CAAA,EAAA;;AAEA;AACA,EAAA,OAAA,EAAA,KAAA,YAAA,IAAA,EAAA,KAAA,UAAA,GAAA,QAAA,GAAA,SAAA;AACA;;;;;;;;;;;;"}
|
|
@@ -13,37 +13,6 @@ function initializeRouterUtils(matchRoutes, stripBasename = false) {
|
|
|
13
13
|
_stripBasename = stripBasename;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* Checks if the given routes or location context suggests this might be a lazy route scenario.
|
|
18
|
-
* This helps determine if we should delay marking navigation spans as "named" to allow for updates
|
|
19
|
-
* when lazy routes are loaded.
|
|
20
|
-
*/
|
|
21
|
-
function isLikelyLazyRouteContext(routes, location) {
|
|
22
|
-
// Check if any route in the current match has lazy properties
|
|
23
|
-
const hasLazyRoute = routes.some(route => {
|
|
24
|
-
return (
|
|
25
|
-
// React Router lazy() route
|
|
26
|
-
route.lazy ||
|
|
27
|
-
// Route with async handlers that might load child routes
|
|
28
|
-
(route.handle &&
|
|
29
|
-
typeof route.handle === 'object' &&
|
|
30
|
-
Object.values(route.handle).some(handler => typeof handler === 'function'))
|
|
31
|
-
);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
if (hasLazyRoute) {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Check if current route is unmatched, which might indicate a lazy route that hasn't loaded yet
|
|
39
|
-
const currentMatches = _matchRoutes(routes, location);
|
|
40
|
-
if (!currentMatches || currentMatches.length === 0) {
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
16
|
// Helper functions
|
|
48
17
|
function pickPath(match) {
|
|
49
18
|
return trimWildcard(match.route.path || '');
|
|
@@ -287,7 +256,6 @@ function resolveRouteNameAndSource(
|
|
|
287
256
|
exports.getNormalizedName = getNormalizedName;
|
|
288
257
|
exports.getNumberOfUrlSegments = getNumberOfUrlSegments;
|
|
289
258
|
exports.initializeRouterUtils = initializeRouterUtils;
|
|
290
|
-
exports.isLikelyLazyRouteContext = isLikelyLazyRouteContext;
|
|
291
259
|
exports.locationIsInsideDescendantRoute = locationIsInsideDescendantRoute;
|
|
292
260
|
exports.pathEndsWithWildcard = pathEndsWithWildcard;
|
|
293
261
|
exports.pathIsWildcardAndHasChildren = pathIsWildcardAndHasChildren;
|