@sentry/react 10.29.0 → 10.31.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.
Files changed (39) hide show
  1. package/build/cjs/reactrouter-compat-utils/instrumentation.js +45 -34
  2. package/build/cjs/reactrouter-compat-utils/instrumentation.js.map +1 -1
  3. package/build/cjs/reactrouter-compat-utils/lazy-routes.js +77 -6
  4. package/build/cjs/reactrouter-compat-utils/lazy-routes.js.map +1 -1
  5. package/build/cjs/reactrouter-compat-utils/utils.js +64 -0
  6. package/build/cjs/reactrouter-compat-utils/utils.js.map +1 -1
  7. package/build/cjs/reactrouterv6.js +1 -0
  8. package/build/cjs/reactrouterv6.js.map +1 -1
  9. package/build/cjs/reactrouterv7.js +1 -0
  10. package/build/cjs/reactrouterv7.js.map +1 -1
  11. package/build/cjs/tanstackrouter.js +7 -2
  12. package/build/cjs/tanstackrouter.js.map +1 -1
  13. package/build/esm/package.json +1 -1
  14. package/build/esm/reactrouter-compat-utils/instrumentation.js +38 -27
  15. package/build/esm/reactrouter-compat-utils/instrumentation.js.map +1 -1
  16. package/build/esm/reactrouter-compat-utils/lazy-routes.js +78 -7
  17. package/build/esm/reactrouter-compat-utils/lazy-routes.js.map +1 -1
  18. package/build/esm/reactrouter-compat-utils/utils.js +61 -1
  19. package/build/esm/reactrouter-compat-utils/utils.js.map +1 -1
  20. package/build/esm/reactrouterv6.js +1 -0
  21. package/build/esm/reactrouterv6.js.map +1 -1
  22. package/build/esm/reactrouterv7.js +1 -0
  23. package/build/esm/reactrouterv7.js.map +1 -1
  24. package/build/esm/tanstackrouter.js +7 -2
  25. package/build/esm/tanstackrouter.js.map +1 -1
  26. package/build/types/reactrouter-compat-utils/index.d.ts +1 -1
  27. package/build/types/reactrouter-compat-utils/index.d.ts.map +1 -1
  28. package/build/types/reactrouter-compat-utils/instrumentation.d.ts +3 -1
  29. package/build/types/reactrouter-compat-utils/instrumentation.d.ts.map +1 -1
  30. package/build/types/reactrouter-compat-utils/lazy-routes.d.ts +7 -3
  31. package/build/types/reactrouter-compat-utils/lazy-routes.d.ts.map +1 -1
  32. package/build/types/reactrouter-compat-utils/utils.d.ts +24 -1
  33. package/build/types/reactrouter-compat-utils/utils.d.ts.map +1 -1
  34. package/build/types/tanstackrouter.d.ts.map +1 -1
  35. package/build/types-ts3.8/reactrouter-compat-utils/index.d.ts +1 -1
  36. package/build/types-ts3.8/reactrouter-compat-utils/instrumentation.d.ts +3 -1
  37. package/build/types-ts3.8/reactrouter-compat-utils/lazy-routes.d.ts +7 -3
  38. package/build/types-ts3.8/reactrouter-compat-utils/utils.d.ts +24 -1
  39. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../src/reactrouter-compat-utils/utils.ts"],"sourcesContent":["import type { TransactionSource } from '@sentry/core';\nimport type { Location, MatchRoutes, RouteMatch, RouteObject } from '../types';\n\n// Global variables that these utilities depend on\nlet _matchRoutes: MatchRoutes;\nlet _stripBasename: boolean = false;\n\n/**\n * Initialize function to set dependencies that the router utilities need.\n * Must be called before using any of the exported utility functions.\n */\nexport function initializeRouterUtils(matchRoutes: MatchRoutes, stripBasename: boolean = false): void {\n _matchRoutes = matchRoutes;\n _stripBasename = stripBasename;\n}\n\n// Helper functions\nfunction pickPath(match: RouteMatch): string {\n return trimWildcard(match.route.path || '');\n}\n\nfunction pickSplat(match: RouteMatch): string {\n return match.params['*'] || '';\n}\n\nfunction trimWildcard(path: string): string {\n return path[path.length - 1] === '*' ? path.slice(0, -1) : path;\n}\n\nfunction trimSlash(path: string): string {\n return path[path.length - 1] === '/' ? path.slice(0, -1) : path;\n}\n\n/**\n * Checks if a path ends with a wildcard character (*).\n */\nexport function pathEndsWithWildcard(path: string): boolean {\n return path.endsWith('*');\n}\n\n/** Checks if transaction name has wildcard (/* or ends with *). */\nexport function transactionNameHasWildcard(name: string): boolean {\n return name.includes('/*') || name.endsWith('*');\n}\n\n/**\n * Checks if a path is a wildcard and has child routes.\n */\nexport function pathIsWildcardAndHasChildren(path: string, branch: RouteMatch<string>): boolean {\n return (pathEndsWithWildcard(path) && !!branch.route.children?.length) || false;\n}\n\n/** Check if route is in descendant route (<Routes> within <Routes>) */\nexport function routeIsDescendant(route: RouteObject): boolean {\n return !!(!route.children && route.element && route.path?.endsWith('/*'));\n}\n\nfunction sendIndexPath(pathBuilder: string, pathname: string, basename: string): [string, TransactionSource] {\n const reconstructedPath =\n pathBuilder && pathBuilder.length > 0\n ? pathBuilder\n : _stripBasename\n ? stripBasenameFromPathname(pathname, basename)\n : pathname;\n\n let formattedPath =\n // If the path ends with a wildcard suffix, remove both the slash and the asterisk\n reconstructedPath.slice(-2) === '/*' ? reconstructedPath.slice(0, -2) : reconstructedPath;\n\n // If the path ends with a slash, remove it (but keep single '/')\n if (formattedPath.length > 1 && formattedPath[formattedPath.length - 1] === '/') {\n formattedPath = formattedPath.slice(0, -1);\n }\n\n return [formattedPath, 'route'];\n}\n\n/**\n * Returns the number of URL segments in the given URL string.\n * Splits at '/' or '\\/' to handle regex URLs correctly.\n *\n * @param url - The URL string to segment.\n * @returns The number of segments in the URL.\n */\nexport function getNumberOfUrlSegments(url: string): number {\n // split at '/' or at '\\/' to split regex urls correctly\n return url.split(/\\\\?\\//).filter(s => s.length > 0 && s !== ',').length;\n}\n\n/**\n * Strip the basename from a pathname if exists.\n *\n * Vendored and modified from `react-router`\n * https://github.com/remix-run/react-router/blob/462bb712156a3f739d6139a0f14810b76b002df6/packages/router/utils.ts#L1038\n */\nfunction stripBasenameFromPathname(pathname: string, basename: string): string {\n if (!basename || basename === '/') {\n return pathname;\n }\n\n if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {\n return pathname;\n }\n\n // We want to leave trailing slash behavior in the user's control, so if they\n // specify a basename with a trailing slash, we should support it\n const startIndex = basename.endsWith('/') ? basename.length - 1 : basename.length;\n const nextChar = pathname.charAt(startIndex);\n if (nextChar && nextChar !== '/') {\n // pathname does not start with basename/\n return pathname;\n }\n\n return pathname.slice(startIndex) || '/';\n}\n\n// Exported utility functions\n\n/**\n * Ensures a path string starts with a forward slash.\n */\nexport function prefixWithSlash(path: string): string {\n return path[0] === '/' ? path : `/${path}`;\n}\n\n/**\n * Rebuilds the route path from all available routes by matching against the current location.\n */\nexport function rebuildRoutePathFromAllRoutes(allRoutes: RouteObject[], location: Location): string {\n const matchedRoutes = _matchRoutes(allRoutes, location) as RouteMatch[];\n\n if (!matchedRoutes || matchedRoutes.length === 0) {\n return '';\n }\n\n for (const match of matchedRoutes) {\n if (match.route.path && match.route.path !== '*') {\n const path = pickPath(match);\n const strippedPath = stripBasenameFromPathname(location.pathname, prefixWithSlash(match.pathnameBase));\n\n if (location.pathname === strippedPath) {\n return trimSlash(strippedPath);\n }\n\n return trimSlash(\n trimSlash(path || '') +\n prefixWithSlash(\n rebuildRoutePathFromAllRoutes(\n allRoutes.filter(route => route !== match.route),\n {\n pathname: strippedPath,\n },\n ),\n ),\n );\n }\n }\n\n return '';\n}\n\n/**\n * Checks if the current location is inside a descendant route (route with splat parameter).\n */\nexport function locationIsInsideDescendantRoute(location: Location, routes: RouteObject[]): boolean {\n const matchedRoutes = _matchRoutes(routes, location) as RouteMatch[];\n\n if (matchedRoutes) {\n for (const match of matchedRoutes) {\n if (routeIsDescendant(match.route) && pickSplat(match)) {\n return true;\n }\n }\n }\n\n return false;\n}\n\n/**\n * Returns a fallback transaction name from location pathname.\n */\nfunction getFallbackTransactionName(location: Location, basename: string): string {\n return _stripBasename ? stripBasenameFromPathname(location.pathname, basename) : location.pathname || '';\n}\n\n/**\n * Gets a normalized route name and transaction source from the current routes and location.\n */\nexport function getNormalizedName(\n routes: RouteObject[],\n location: Location,\n branches: RouteMatch[],\n basename: string = '',\n): [string, TransactionSource] {\n if (!routes || routes.length === 0) {\n return [_stripBasename ? stripBasenameFromPathname(location.pathname, basename) : location.pathname, 'url'];\n }\n\n if (!branches) {\n return [getFallbackTransactionName(location, basename), 'url'];\n }\n\n let pathBuilder = '';\n\n for (const branch of branches) {\n const route = branch.route;\n if (!route) {\n continue;\n }\n\n // Early return for index routes\n if (route.index) {\n return sendIndexPath(pathBuilder, branch.pathname, basename);\n }\n\n const path = route.path;\n if (!path || pathIsWildcardAndHasChildren(path, branch)) {\n continue;\n }\n\n // Build the route path\n const newPath = path[0] === '/' || pathBuilder[pathBuilder.length - 1] === '/' ? path : `/${path}`;\n pathBuilder = trimSlash(pathBuilder) + prefixWithSlash(newPath);\n\n // Check if this path matches the current location\n if (trimSlash(location.pathname) !== trimSlash(basename + branch.pathname)) {\n continue;\n }\n\n // Check if this is a parameterized route like /stores/:storeId/products/:productId\n if (\n getNumberOfUrlSegments(pathBuilder) !== getNumberOfUrlSegments(branch.pathname) &&\n !pathEndsWithWildcard(pathBuilder)\n ) {\n return [(_stripBasename ? '' : basename) + newPath, 'route'];\n }\n\n // Handle wildcard routes with children - strip trailing wildcard\n if (pathIsWildcardAndHasChildren(pathBuilder, branch)) {\n pathBuilder = pathBuilder.slice(0, -1);\n }\n\n return [(_stripBasename ? '' : basename) + pathBuilder, 'route'];\n }\n\n // Fallback when no matching route found\n return [getFallbackTransactionName(location, basename), 'url'];\n}\n\n/**\n * Shared helper function to resolve route name and source\n */\nexport function resolveRouteNameAndSource(\n location: Location,\n routes: RouteObject[],\n allRoutes: RouteObject[],\n branches: RouteMatch[],\n basename: string = '',\n): [string, TransactionSource] {\n let name: string | undefined;\n let source: TransactionSource = 'url';\n\n const isInDescendantRoute = locationIsInsideDescendantRoute(location, allRoutes);\n\n if (isInDescendantRoute) {\n name = prefixWithSlash(rebuildRoutePathFromAllRoutes(allRoutes, location));\n source = 'route';\n }\n\n if (!isInDescendantRoute || !name) {\n [name, source] = getNormalizedName(routes, location, branches, basename);\n }\n\n return [name || location.pathname, source];\n}\n"],"names":[],"mappings":"AAGA;AACA,IAAI,YAAY;AAChB,IAAI,cAAc,GAAY,KAAK;;AAEnC;AACA;AACA;AACA;AACO,SAAS,qBAAqB,CAAC,WAAW,EAAe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A;AACA,MAAA,OAAA,CAAA,CAAA,cAAA,GAAA,EAAA,GAAA,QAAA,IAAA,OAAA,EAAA,OAAA,CAAA;AACA,IAAA;;AAEA;AACA,IAAA,IAAA,4BAAA,CAAA,WAAA,EAAA,MAAA,CAAA,EAAA;AACA,MAAA,WAAA,GAAA,WAAA,CAAA,KAAA,CAAA,CAAA,EAAA,EAAA,CAAA;AACA,IAAA;;AAEA,IAAA,OAAA,CAAA,CAAA,cAAA,GAAA,EAAA,GAAA,QAAA,IAAA,WAAA,EAAA,OAAA,CAAA;AACA,EAAA;;AAEA;AACA,EAAA,OAAA,CAAA,0BAAA,CAAA,QAAA,EAAA,QAAA,CAAA,EAAA,KAAA,CAAA;AACA;;AAEA;AACA;AACA;AACA,SAAA,yBAAA;AACA,EAAA,QAAA;AACA,EAAA,MAAA;AACA,EAAA,SAAA;AACA,EAAA,QAAA;AACA,EAAA,QAAA,GAAA,EAAA;AACA,EAAA;AACA,EAAA,IAAA,IAAA;AACA,EAAA,IAAA,MAAA,GAAA,KAAA;;AAEA,EAAA,MAAA,mBAAA,GAAA,+BAAA,CAAA,QAAA,EAAA,SAAA,CAAA;;AAEA,EAAA,IAAA,mBAAA,EAAA;AACA,IAAA,IAAA,GAAA,eAAA,CAAA,6BAAA,CAAA,SAAA,EAAA,QAAA,CAAA,CAAA;AACA,IAAA,MAAA,GAAA,OAAA;AACA,EAAA;;AAEA,EAAA,IAAA,CAAA,mBAAA,IAAA,CAAA,IAAA,EAAA;AACA,IAAA,CAAA,IAAA,EAAA,MAAA,CAAA,GAAA,iBAAA,CAAA,MAAA,EAAA,QAAA,EAAA,QAAA,EAAA,QAAA,CAAA;AACA,EAAA;;AAEA,EAAA,OAAA,CAAA,IAAA,IAAA,QAAA,CAAA,QAAA,EAAA,MAAA,CAAA;AACA;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../src/reactrouter-compat-utils/utils.ts"],"sourcesContent":["import type { Span, TransactionSource } from '@sentry/core';\nimport { debug, getActiveSpan, getRootSpan, spanToJSON } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport type { Location, MatchRoutes, RouteMatch, RouteObject } from '../types';\n\n// Global variables that these utilities depend on\nlet _matchRoutes: MatchRoutes;\nlet _stripBasename: boolean = false;\n\n// Navigation context stack for nested/concurrent patchRoutesOnNavigation calls.\n// Required because window.location hasn't updated yet when handlers are invoked.\ninterface NavigationContext {\n token: object;\n targetPath: string | undefined;\n span: Span | undefined;\n}\n\nconst _navigationContextStack: NavigationContext[] = [];\nconst MAX_CONTEXT_STACK_SIZE = 10;\n\n/**\n * Pushes a navigation context and returns a unique token for cleanup.\n * The token uses object identity for uniqueness (no counter needed).\n */\nexport function setNavigationContext(targetPath: string | undefined, span: Span | undefined): object {\n const token = {};\n // Prevent unbounded stack growth - oldest (likely stale) contexts are evicted first\n if (_navigationContextStack.length >= MAX_CONTEXT_STACK_SIZE) {\n DEBUG_BUILD && debug.warn('[React Router] Navigation context stack overflow - removing oldest context');\n _navigationContextStack.shift();\n }\n _navigationContextStack.push({ token, targetPath, span });\n return token;\n}\n\n/**\n * Clears the navigation context if it's on top of the stack (LIFO).\n * If our context is not on top (out-of-order completion), we leave it -\n * it will be cleaned up by overflow protection when the stack fills up.\n */\nexport function clearNavigationContext(token: object): void {\n const top = _navigationContextStack[_navigationContextStack.length - 1];\n if (top?.token === token) {\n _navigationContextStack.pop();\n }\n}\n\n/** Gets the current (most recent) navigation context if inside a patchRoutesOnNavigation call. */\nexport function getNavigationContext(): NavigationContext | null {\n const length = _navigationContextStack.length;\n // The `?? null` converts undefined (from array access) to null to match return type\n return length > 0 ? (_navigationContextStack[length - 1] ?? null) : null;\n}\n\n/**\n * Initialize function to set dependencies that the router utilities need.\n * Must be called before using any of the exported utility functions.\n */\nexport function initializeRouterUtils(matchRoutes: MatchRoutes, stripBasename: boolean = false): void {\n _matchRoutes = matchRoutes;\n _stripBasename = stripBasename;\n}\n\n// Helper functions\nfunction pickPath(match: RouteMatch): string {\n return trimWildcard(match.route.path || '');\n}\n\nfunction pickSplat(match: RouteMatch): string {\n return match.params['*'] || '';\n}\n\nfunction trimWildcard(path: string): string {\n return path[path.length - 1] === '*' ? path.slice(0, -1) : path;\n}\n\nfunction trimSlash(path: string): string {\n return path[path.length - 1] === '/' ? path.slice(0, -1) : path;\n}\n\n/**\n * Checks if a path ends with a wildcard character (*).\n */\nexport function pathEndsWithWildcard(path: string): boolean {\n return path.endsWith('*');\n}\n\n/** Checks if transaction name has wildcard (/* or ends with *). */\nexport function transactionNameHasWildcard(name: string): boolean {\n return name.includes('/*') || name.endsWith('*');\n}\n\n/**\n * Checks if a path is a wildcard and has child routes.\n */\nexport function pathIsWildcardAndHasChildren(path: string, branch: RouteMatch<string>): boolean {\n return (pathEndsWithWildcard(path) && !!branch.route.children?.length) || false;\n}\n\n/** Check if route is in descendant route (<Routes> within <Routes>) */\nexport function routeIsDescendant(route: RouteObject): boolean {\n return !!(!route.children && route.element && route.path?.endsWith('/*'));\n}\n\nfunction sendIndexPath(pathBuilder: string, pathname: string, basename: string): [string, TransactionSource] {\n const reconstructedPath =\n pathBuilder && pathBuilder.length > 0\n ? pathBuilder\n : _stripBasename\n ? stripBasenameFromPathname(pathname, basename)\n : pathname;\n\n let formattedPath =\n // If the path ends with a wildcard suffix, remove both the slash and the asterisk\n reconstructedPath.slice(-2) === '/*' ? reconstructedPath.slice(0, -2) : reconstructedPath;\n\n // If the path ends with a slash, remove it (but keep single '/')\n if (formattedPath.length > 1 && formattedPath[formattedPath.length - 1] === '/') {\n formattedPath = formattedPath.slice(0, -1);\n }\n\n return [formattedPath, 'route'];\n}\n\n/**\n * Returns the number of URL segments in the given URL string.\n * Splits at '/' or '\\/' to handle regex URLs correctly.\n *\n * @param url - The URL string to segment.\n * @returns The number of segments in the URL.\n */\nexport function getNumberOfUrlSegments(url: string): number {\n // split at '/' or at '\\/' to split regex urls correctly\n return url.split(/\\\\?\\//).filter(s => s.length > 0 && s !== ',').length;\n}\n\n/**\n * Strip the basename from a pathname if exists.\n *\n * Vendored and modified from `react-router`\n * https://github.com/remix-run/react-router/blob/462bb712156a3f739d6139a0f14810b76b002df6/packages/router/utils.ts#L1038\n */\nfunction stripBasenameFromPathname(pathname: string, basename: string): string {\n if (!basename || basename === '/') {\n return pathname;\n }\n\n if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {\n return pathname;\n }\n\n // We want to leave trailing slash behavior in the user's control, so if they\n // specify a basename with a trailing slash, we should support it\n const startIndex = basename.endsWith('/') ? basename.length - 1 : basename.length;\n const nextChar = pathname.charAt(startIndex);\n if (nextChar && nextChar !== '/') {\n // pathname does not start with basename/\n return pathname;\n }\n\n return pathname.slice(startIndex) || '/';\n}\n\n// Exported utility functions\n\n/**\n * Ensures a path string starts with a forward slash.\n */\nexport function prefixWithSlash(path: string): string {\n return path[0] === '/' ? path : `/${path}`;\n}\n\n/**\n * Rebuilds the route path from all available routes by matching against the current location.\n */\nexport function rebuildRoutePathFromAllRoutes(allRoutes: RouteObject[], location: Location): string {\n const matchedRoutes = _matchRoutes(allRoutes, location) as RouteMatch[];\n\n if (!matchedRoutes || matchedRoutes.length === 0) {\n return '';\n }\n\n for (const match of matchedRoutes) {\n if (match.route.path && match.route.path !== '*') {\n const path = pickPath(match);\n const strippedPath = stripBasenameFromPathname(location.pathname, prefixWithSlash(match.pathnameBase));\n\n if (location.pathname === strippedPath) {\n return trimSlash(strippedPath);\n }\n\n return trimSlash(\n trimSlash(path || '') +\n prefixWithSlash(\n rebuildRoutePathFromAllRoutes(\n allRoutes.filter(route => route !== match.route),\n {\n pathname: strippedPath,\n },\n ),\n ),\n );\n }\n }\n\n return '';\n}\n\n/**\n * Checks if the current location is inside a descendant route (route with splat parameter).\n */\nexport function locationIsInsideDescendantRoute(location: Location, routes: RouteObject[]): boolean {\n const matchedRoutes = _matchRoutes(routes, location) as RouteMatch[];\n\n if (matchedRoutes) {\n for (const match of matchedRoutes) {\n if (routeIsDescendant(match.route) && pickSplat(match)) {\n return true;\n }\n }\n }\n\n return false;\n}\n\n/**\n * Returns a fallback transaction name from location pathname.\n */\nfunction getFallbackTransactionName(location: Location, basename: string): string {\n return _stripBasename ? stripBasenameFromPathname(location.pathname, basename) : location.pathname || '';\n}\n\n/**\n * Gets a normalized route name and transaction source from the current routes and location.\n */\nexport function getNormalizedName(\n routes: RouteObject[],\n location: Location,\n branches: RouteMatch[],\n basename: string = '',\n): [string, TransactionSource] {\n if (!routes || routes.length === 0) {\n return [_stripBasename ? stripBasenameFromPathname(location.pathname, basename) : location.pathname, 'url'];\n }\n\n if (!branches) {\n return [getFallbackTransactionName(location, basename), 'url'];\n }\n\n let pathBuilder = '';\n\n for (const branch of branches) {\n const route = branch.route;\n if (!route) {\n continue;\n }\n\n // Early return for index routes\n if (route.index) {\n return sendIndexPath(pathBuilder, branch.pathname, basename);\n }\n\n const path = route.path;\n if (!path || pathIsWildcardAndHasChildren(path, branch)) {\n continue;\n }\n\n // Build the route path\n const newPath = path[0] === '/' || pathBuilder[pathBuilder.length - 1] === '/' ? path : `/${path}`;\n pathBuilder = trimSlash(pathBuilder) + prefixWithSlash(newPath);\n\n // Check if this path matches the current location\n if (trimSlash(location.pathname) !== trimSlash(basename + branch.pathname)) {\n continue;\n }\n\n // Check if this is a parameterized route like /stores/:storeId/products/:productId\n if (\n getNumberOfUrlSegments(pathBuilder) !== getNumberOfUrlSegments(branch.pathname) &&\n !pathEndsWithWildcard(pathBuilder)\n ) {\n return [(_stripBasename ? '' : basename) + newPath, 'route'];\n }\n\n // Handle wildcard routes with children - strip trailing wildcard\n if (pathIsWildcardAndHasChildren(pathBuilder, branch)) {\n pathBuilder = pathBuilder.slice(0, -1);\n }\n\n return [(_stripBasename ? '' : basename) + pathBuilder, 'route'];\n }\n\n // Fallback when no matching route found\n return [getFallbackTransactionName(location, basename), 'url'];\n}\n\n/**\n * Shared helper function to resolve route name and source\n */\nexport function resolveRouteNameAndSource(\n location: Location,\n routes: RouteObject[],\n allRoutes: RouteObject[],\n branches: RouteMatch[],\n basename: string = '',\n): [string, TransactionSource] {\n let name: string | undefined;\n let source: TransactionSource = 'url';\n\n const isInDescendantRoute = locationIsInsideDescendantRoute(location, allRoutes);\n\n if (isInDescendantRoute) {\n name = prefixWithSlash(rebuildRoutePathFromAllRoutes(allRoutes, location));\n source = 'route';\n }\n\n if (!isInDescendantRoute || !name) {\n [name, source] = getNormalizedName(routes, location, branches, basename);\n }\n\n return [name || location.pathname, source];\n}\n\n/**\n * Gets the active root span if it's a pageload or navigation span.\n */\nexport function 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":[],"mappings":";;;AAKA;AACA,IAAI,YAAY;AAChB,IAAI,cAAc,GAAY,KAAK;;AAEnC;AACA;;AAOA,MAAM,uBAAuB,GAAwB,EAAE;AACvD,MAAM,sBAAA,GAAyB,EAAE;;AAEjC;AACA;AACA;AACA;AACO,SAAS,oBAAoB,CAAC,UAAU,EAAsB,IAAI,EAA4B;AACrG,EAAE,MAAM,KAAA,GAAQ,EAAE;AAClB;AACA,EAAE,IAAI,uBAAuB,CAAC,MAAA,IAAU,sBAAsB,EAAE;AAChE,IAAI,eAAe,KAAK,CAAC,IAAI,CAAC,4EAA4E,CAAC;AAC3G,IAAI,uBAAuB,CAAC,KAAK,EAAE;AACnC,EAAE;AACF,EAAE,uBAAuB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,IAAA,EAAM,CAAC;AAC3D,EAAE,OAAO,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,sBAAsB,CAAC,KAAK,EAAgB;AAC5D,EAAE,MAAM,GAAA,GAAM,uBAAuB,CAAC,uBAAuB,CAAC,MAAA,GAAS,CAAC,CAAC;AACzE,EAA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EAAA,IAAA,CAAA,mBAAA,IAAA,CAAA,IAAA,EAAA;AACA,IAAA,CAAA,IAAA,EAAA,MAAA,CAAA,GAAA,iBAAA,CAAA,MAAA,EAAA,QAAA,EAAA,QAAA,EAAA,QAAA,CAAA;AACA,EAAA;;AAEA,EAAA,OAAA,CAAA,IAAA,IAAA,QAAA,CAAA,QAAA,EAAA,MAAA,CAAA;AACA;;AAEA;AACA;AACA;AACA,SAAA,iBAAA,GAAA;AACA,EAAA,MAAA,IAAA,GAAA,aAAA,EAAA;AACA,EAAA,MAAA,QAAA,GAAA,IAAA,GAAA,WAAA,CAAA,IAAA,CAAA,GAAA,SAAA;;AAEA,EAAA,IAAA,CAAA,QAAA,EAAA;AACA,IAAA,OAAA,SAAA;AACA,EAAA;;AAEA,EAAA,MAAA,EAAA,GAAA,UAAA,CAAA,QAAA,CAAA,CAAA,EAAA;;AAEA;AACA,EAAA,OAAA,EAAA,KAAA,YAAA,IAAA,EAAA,KAAA,UAAA,GAAA,QAAA,GAAA,SAAA;AACA;;;;"}
@@ -1,5 +1,6 @@
1
1
  import { createReactRouterV6CompatibleTracingIntegration, createV6CompatibleWithSentryReactRouterRouting, createV6CompatibleWrapUseRoutes, createV6CompatibleWrapCreateBrowserRouter, createV6CompatibleWrapCreateMemoryRouter } from './reactrouter-compat-utils/instrumentation.js';
2
2
  import '@sentry/core';
3
+ import '@sentry/browser';
3
4
 
4
5
  /**
5
6
  * A browser tracing integration that uses React Router v6 to instrument navigations.
@@ -1 +1 @@
1
- {"version":3,"file":"reactrouterv6.js","sources":["../../src/reactrouterv6.tsx"],"sourcesContent":["import type { browserTracingIntegration } from '@sentry/browser';\nimport type { Integration } from '@sentry/core';\nimport type { ReactRouterOptions } from './reactrouter-compat-utils';\nimport {\n createReactRouterV6CompatibleTracingIntegration,\n createV6CompatibleWithSentryReactRouterRouting,\n createV6CompatibleWrapCreateBrowserRouter,\n createV6CompatibleWrapCreateMemoryRouter,\n createV6CompatibleWrapUseRoutes,\n} from './reactrouter-compat-utils';\nimport type { CreateRouterFunction, Router, RouterState, UseRoutes } from './types';\n\n/**\n * A browser tracing integration that uses React Router v6 to instrument navigations.\n * Expects `useEffect`, `useLocation`, `useNavigationType`, `createRoutesFromChildren` and `matchRoutes` to be passed as options.\n */\nexport function reactRouterV6BrowserTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n): Integration {\n return createReactRouterV6CompatibleTracingIntegration(options, '6');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v6 useRoutes hook.\n * This is used to automatically capture route changes as transactions when using the useRoutes hook.\n */\nexport function wrapUseRoutesV6(origUseRoutes: UseRoutes): UseRoutes {\n return createV6CompatibleWrapUseRoutes(origUseRoutes, '6');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v6 createBrowserRouter function.\n * This is used to automatically capture route changes as transactions when using the createBrowserRouter API.\n */\nexport function wrapCreateBrowserRouterV6<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(createRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter> {\n return createV6CompatibleWrapCreateBrowserRouter(createRouterFunction, '6');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v6 createMemoryRouter function.\n * This is used to automatically capture route changes as transactions when using the createMemoryRouter API.\n * The difference between createBrowserRouter and createMemoryRouter is that with createMemoryRouter,\n * optional `initialEntries` are also taken into account.\n */\nexport function wrapCreateMemoryRouterV6<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(createMemoryRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter> {\n return createV6CompatibleWrapCreateMemoryRouter(createMemoryRouterFunction, '6');\n}\n\n/**\n * A higher-order component that adds Sentry routing instrumentation to a React Router v6 Route component.\n * This is used to automatically capture route changes as transactions.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function withSentryReactRouterV6Routing<P extends Record<string, any>, R extends React.FC<P>>(routes: R): R {\n return createV6CompatibleWithSentryReactRouterRouting<P, R>(routes, '6');\n}\n"],"names":[],"mappings":";;;AAYA;AACA;AACA;AACA;AACO,SAAS,sCAAsC;AACtD,EAAE,OAAO;AACT,EAAe;AACf,EAAE,OAAO,+CAA+C,CAAC,OAAO,EAAE,GAAG,CAAC;AACtE;;AAEA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,aAAa,EAAwB;AACrE,EAAE,OAAO,+BAA+B,CAAC,aAAa,EAAE,GAAG,CAAC;AAC5D;;AAEA;AACA;AACA;AACA;AACO,SAAS;;AAGhB,CAAE,oBAAoB,EAAgF;AACtG,EAAE,OAAO,yCAAyC,CAAC,oBAAoB,EAAE,GAAG,CAAC;AAC7E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS;;AAGhB,CAAE,0BAA0B,EAAgF;AAC5G,EAAE,OAAO,wCAAwC,CAAC,0BAA0B,EAAE,GAAG,CAAC;AAClF;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,8BAA8B,CAAuD,MAAM,EAAQ;AACnH,EAAE,OAAO,8CAA8C,CAAO,MAAM,EAAE,GAAG,CAAC;AAC1E;;;;"}
1
+ {"version":3,"file":"reactrouterv6.js","sources":["../../src/reactrouterv6.tsx"],"sourcesContent":["import type { browserTracingIntegration } from '@sentry/browser';\nimport type { Integration } from '@sentry/core';\nimport type { ReactRouterOptions } from './reactrouter-compat-utils';\nimport {\n createReactRouterV6CompatibleTracingIntegration,\n createV6CompatibleWithSentryReactRouterRouting,\n createV6CompatibleWrapCreateBrowserRouter,\n createV6CompatibleWrapCreateMemoryRouter,\n createV6CompatibleWrapUseRoutes,\n} from './reactrouter-compat-utils';\nimport type { CreateRouterFunction, Router, RouterState, UseRoutes } from './types';\n\n/**\n * A browser tracing integration that uses React Router v6 to instrument navigations.\n * Expects `useEffect`, `useLocation`, `useNavigationType`, `createRoutesFromChildren` and `matchRoutes` to be passed as options.\n */\nexport function reactRouterV6BrowserTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n): Integration {\n return createReactRouterV6CompatibleTracingIntegration(options, '6');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v6 useRoutes hook.\n * This is used to automatically capture route changes as transactions when using the useRoutes hook.\n */\nexport function wrapUseRoutesV6(origUseRoutes: UseRoutes): UseRoutes {\n return createV6CompatibleWrapUseRoutes(origUseRoutes, '6');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v6 createBrowserRouter function.\n * This is used to automatically capture route changes as transactions when using the createBrowserRouter API.\n */\nexport function wrapCreateBrowserRouterV6<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(createRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter> {\n return createV6CompatibleWrapCreateBrowserRouter(createRouterFunction, '6');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v6 createMemoryRouter function.\n * This is used to automatically capture route changes as transactions when using the createMemoryRouter API.\n * The difference between createBrowserRouter and createMemoryRouter is that with createMemoryRouter,\n * optional `initialEntries` are also taken into account.\n */\nexport function wrapCreateMemoryRouterV6<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(createMemoryRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter> {\n return createV6CompatibleWrapCreateMemoryRouter(createMemoryRouterFunction, '6');\n}\n\n/**\n * A higher-order component that adds Sentry routing instrumentation to a React Router v6 Route component.\n * This is used to automatically capture route changes as transactions.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function withSentryReactRouterV6Routing<P extends Record<string, any>, R extends React.FC<P>>(routes: R): R {\n return createV6CompatibleWithSentryReactRouterRouting<P, R>(routes, '6');\n}\n"],"names":[],"mappings":";;;;AAYA;AACA;AACA;AACA;AACO,SAAS,sCAAsC;AACtD,EAAE,OAAO;AACT,EAAe;AACf,EAAE,OAAO,+CAA+C,CAAC,OAAO,EAAE,GAAG,CAAC;AACtE;;AAEA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,aAAa,EAAwB;AACrE,EAAE,OAAO,+BAA+B,CAAC,aAAa,EAAE,GAAG,CAAC;AAC5D;;AAEA;AACA;AACA;AACA;AACO,SAAS;;AAGhB,CAAE,oBAAoB,EAAgF;AACtG,EAAE,OAAO,yCAAyC,CAAC,oBAAoB,EAAE,GAAG,CAAC;AAC7E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS;;AAGhB,CAAE,0BAA0B,EAAgF;AAC5G,EAAE,OAAO,wCAAwC,CAAC,0BAA0B,EAAE,GAAG,CAAC;AAClF;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,8BAA8B,CAAuD,MAAM,EAAQ;AACnH,EAAE,OAAO,8CAA8C,CAAO,MAAM,EAAE,GAAG,CAAC;AAC1E;;;;"}
@@ -1,5 +1,6 @@
1
1
  import { createReactRouterV6CompatibleTracingIntegration, createV6CompatibleWithSentryReactRouterRouting, createV6CompatibleWrapCreateBrowserRouter, createV6CompatibleWrapCreateMemoryRouter, createV6CompatibleWrapUseRoutes } from './reactrouter-compat-utils/instrumentation.js';
2
2
  import '@sentry/core';
3
+ import '@sentry/browser';
3
4
 
4
5
  /**
5
6
  * A browser tracing integration that uses React Router v7 to instrument navigations.
@@ -1 +1 @@
1
- {"version":3,"file":"reactrouterv7.js","sources":["../../src/reactrouterv7.tsx"],"sourcesContent":["// React Router v7 uses the same integration as v6\nimport type { browserTracingIntegration } from '@sentry/browser';\nimport type { Integration } from '@sentry/core';\nimport type { ReactRouterOptions } from './reactrouter-compat-utils';\nimport {\n createReactRouterV6CompatibleTracingIntegration,\n createV6CompatibleWithSentryReactRouterRouting,\n createV6CompatibleWrapCreateBrowserRouter,\n createV6CompatibleWrapCreateMemoryRouter,\n createV6CompatibleWrapUseRoutes,\n} from './reactrouter-compat-utils';\nimport type { CreateRouterFunction, Router, RouterState, UseRoutes } from './types';\n\n/**\n * A browser tracing integration that uses React Router v7 to instrument navigations.\n * Expects `useEffect`, `useLocation`, `useNavigationType`, `createRoutesFromChildren` and `matchRoutes` to be passed as options.\n */\nexport function reactRouterV7BrowserTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n): Integration {\n return createReactRouterV6CompatibleTracingIntegration(options, '7');\n}\n\n/**\n * A higher-order component that adds Sentry routing instrumentation to a React Router v7 Route component.\n * This is used to automatically capture route changes as transactions.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function withSentryReactRouterV7Routing<P extends Record<string, any>, R extends React.FC<P>>(routes: R): R {\n return createV6CompatibleWithSentryReactRouterRouting<P, R>(routes, '7');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v7 createBrowserRouter function.\n * This is used to automatically capture route changes as transactions when using the createBrowserRouter API.\n */\nexport function wrapCreateBrowserRouterV7<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(createRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter> {\n return createV6CompatibleWrapCreateBrowserRouter(createRouterFunction, '7');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v7 createMemoryRouter function.\n * This is used to automatically capture route changes as transactions when using the createMemoryRouter API.\n * The difference between createBrowserRouter and createMemoryRouter is that with createMemoryRouter,\n * optional `initialEntries` are also taken into account.\n */\nexport function wrapCreateMemoryRouterV7<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(createMemoryRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter> {\n return createV6CompatibleWrapCreateMemoryRouter(createMemoryRouterFunction, '7');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v7 useRoutes hook.\n * This is used to automatically capture route changes as transactions when using the useRoutes hook.\n */\nexport function wrapUseRoutesV7(origUseRoutes: UseRoutes): UseRoutes {\n return createV6CompatibleWrapUseRoutes(origUseRoutes, '7');\n}\n"],"names":[],"mappings":";;;AAaA;AACA;AACA;AACA;AACO,SAAS,sCAAsC;AACtD,EAAE,OAAO;AACT,EAAe;AACf,EAAE,OAAO,+CAA+C,CAAC,OAAO,EAAE,GAAG,CAAC;AACtE;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,8BAA8B,CAAuD,MAAM,EAAQ;AACnH,EAAE,OAAO,8CAA8C,CAAO,MAAM,EAAE,GAAG,CAAC;AAC1E;;AAEA;AACA;AACA;AACA;AACO,SAAS;;AAGhB,CAAE,oBAAoB,EAAgF;AACtG,EAAE,OAAO,yCAAyC,CAAC,oBAAoB,EAAE,GAAG,CAAC;AAC7E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS;;AAGhB,CAAE,0BAA0B,EAAgF;AAC5G,EAAE,OAAO,wCAAwC,CAAC,0BAA0B,EAAE,GAAG,CAAC;AAClF;;AAEA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,aAAa,EAAwB;AACrE,EAAE,OAAO,+BAA+B,CAAC,aAAa,EAAE,GAAG,CAAC;AAC5D;;;;"}
1
+ {"version":3,"file":"reactrouterv7.js","sources":["../../src/reactrouterv7.tsx"],"sourcesContent":["// React Router v7 uses the same integration as v6\nimport type { browserTracingIntegration } from '@sentry/browser';\nimport type { Integration } from '@sentry/core';\nimport type { ReactRouterOptions } from './reactrouter-compat-utils';\nimport {\n createReactRouterV6CompatibleTracingIntegration,\n createV6CompatibleWithSentryReactRouterRouting,\n createV6CompatibleWrapCreateBrowserRouter,\n createV6CompatibleWrapCreateMemoryRouter,\n createV6CompatibleWrapUseRoutes,\n} from './reactrouter-compat-utils';\nimport type { CreateRouterFunction, Router, RouterState, UseRoutes } from './types';\n\n/**\n * A browser tracing integration that uses React Router v7 to instrument navigations.\n * Expects `useEffect`, `useLocation`, `useNavigationType`, `createRoutesFromChildren` and `matchRoutes` to be passed as options.\n */\nexport function reactRouterV7BrowserTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n): Integration {\n return createReactRouterV6CompatibleTracingIntegration(options, '7');\n}\n\n/**\n * A higher-order component that adds Sentry routing instrumentation to a React Router v7 Route component.\n * This is used to automatically capture route changes as transactions.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function withSentryReactRouterV7Routing<P extends Record<string, any>, R extends React.FC<P>>(routes: R): R {\n return createV6CompatibleWithSentryReactRouterRouting<P, R>(routes, '7');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v7 createBrowserRouter function.\n * This is used to automatically capture route changes as transactions when using the createBrowserRouter API.\n */\nexport function wrapCreateBrowserRouterV7<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(createRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter> {\n return createV6CompatibleWrapCreateBrowserRouter(createRouterFunction, '7');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v7 createMemoryRouter function.\n * This is used to automatically capture route changes as transactions when using the createMemoryRouter API.\n * The difference between createBrowserRouter and createMemoryRouter is that with createMemoryRouter,\n * optional `initialEntries` are also taken into account.\n */\nexport function wrapCreateMemoryRouterV7<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(createMemoryRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter> {\n return createV6CompatibleWrapCreateMemoryRouter(createMemoryRouterFunction, '7');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v7 useRoutes hook.\n * This is used to automatically capture route changes as transactions when using the useRoutes hook.\n */\nexport function wrapUseRoutesV7(origUseRoutes: UseRoutes): UseRoutes {\n return createV6CompatibleWrapUseRoutes(origUseRoutes, '7');\n}\n"],"names":[],"mappings":";;;;AAaA;AACA;AACA;AACA;AACO,SAAS,sCAAsC;AACtD,EAAE,OAAO;AACT,EAAe;AACf,EAAE,OAAO,+CAA+C,CAAC,OAAO,EAAE,GAAG,CAAC;AACtE;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,8BAA8B,CAAuD,MAAM,EAAQ;AACnH,EAAE,OAAO,8CAA8C,CAAO,MAAM,EAAE,GAAG,CAAC;AAC1E;;AAEA;AACA;AACA;AACA;AACO,SAAS;;AAGhB,CAAE,oBAAoB,EAAgF;AACtG,EAAE,OAAO,yCAAyC,CAAC,oBAAoB,EAAE,GAAG,CAAC;AAC7E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS;;AAGhB,CAAE,0BAA0B,EAAgF;AAC5G,EAAE,OAAO,wCAAwC,CAAC,0BAA0B,EAAE,GAAG,CAAC;AAClF;;AAEA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,aAAa,EAAwB;AACrE,EAAE,OAAO,+BAA+B,CAAC,aAAa,EAAE,GAAG,CAAC;AAC5D;;;;"}
@@ -53,8 +53,13 @@ function tanstackRouterBrowserTracingIntegration(
53
53
  if (instrumentNavigation) {
54
54
  // The onBeforeNavigate hook is called at the very beginning of a navigation and is only called once per navigation, even when the user is redirected
55
55
  castRouterInstance.subscribe('onBeforeNavigate', onBeforeNavigateArgs => {
56
- // onBeforeNavigate is called during pageloads. We can avoid creating navigation spans by comparing the states of the to and from arguments.
57
- if (onBeforeNavigateArgs.toLocation.state === onBeforeNavigateArgs.fromLocation?.state) {
56
+ // onBeforeNavigate is called during pageloads. We can avoid creating navigation spans by:
57
+ // 1. Checking if there's no fromLocation (initial pageload)
58
+ // 2. Comparing the states of the to and from arguments
59
+ if (
60
+ !onBeforeNavigateArgs.fromLocation ||
61
+ onBeforeNavigateArgs.toLocation.state === onBeforeNavigateArgs.fromLocation.state
62
+ ) {
58
63
  return;
59
64
  }
60
65
 
@@ -1 +1 @@
1
- {"version":3,"file":"tanstackrouter.js","sources":["../../src/tanstackrouter.ts"],"sourcesContent":["import {\n browserTracingIntegration as originalBrowserTracingIntegration,\n startBrowserTracingNavigationSpan,\n startBrowserTracingPageLoadSpan,\n WINDOW,\n} from '@sentry/browser';\nimport type { Integration } from '@sentry/core';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '@sentry/core';\nimport type { VendoredTanstackRouter, VendoredTanstackRouterRouteMatch } from './vendor/tanstackrouter-types';\n\n/**\n * A custom browser tracing integration for TanStack Router.\n *\n * The minimum compatible version of `@tanstack/react-router` is `1.64.0`.\n *\n * @param router A TanStack Router `Router` instance that should be used for routing instrumentation.\n * @param options Sentry browser tracing configuration.\n */\nexport function tanstackRouterBrowserTracingIntegration(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n router: any, // This is `any` because we don't want any type mismatches if TanStack Router changes their types\n options: Parameters<typeof originalBrowserTracingIntegration>[0] = {},\n): Integration {\n const castRouterInstance: VendoredTanstackRouter = router;\n\n const browserTracingIntegrationInstance = originalBrowserTracingIntegration({\n ...options,\n instrumentNavigation: false,\n instrumentPageLoad: false,\n });\n\n const { instrumentPageLoad = true, instrumentNavigation = true } = options;\n\n return {\n ...browserTracingIntegrationInstance,\n afterAllSetup(client) {\n browserTracingIntegrationInstance.afterAllSetup(client);\n\n const initialWindowLocation = WINDOW.location;\n if (instrumentPageLoad && initialWindowLocation) {\n const matchedRoutes = castRouterInstance.matchRoutes(\n initialWindowLocation.pathname,\n castRouterInstance.options.parseSearch(initialWindowLocation.search),\n { preload: false, throwOnError: false },\n );\n\n const lastMatch = matchedRoutes[matchedRoutes.length - 1];\n\n startBrowserTracingPageLoadSpan(client, {\n name: lastMatch ? lastMatch.routeId : initialWindowLocation.pathname,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.tanstack_router',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: lastMatch ? 'route' : 'url',\n ...routeMatchToParamSpanAttributes(lastMatch),\n },\n });\n }\n\n if (instrumentNavigation) {\n // The onBeforeNavigate hook is called at the very beginning of a navigation and is only called once per navigation, even when the user is redirected\n castRouterInstance.subscribe('onBeforeNavigate', onBeforeNavigateArgs => {\n // onBeforeNavigate is called during pageloads. We can avoid creating navigation spans by comparing the states of the to and from arguments.\n if (onBeforeNavigateArgs.toLocation.state === onBeforeNavigateArgs.fromLocation?.state) {\n return;\n }\n\n const onResolvedMatchedRoutes = castRouterInstance.matchRoutes(\n onBeforeNavigateArgs.toLocation.pathname,\n onBeforeNavigateArgs.toLocation.search,\n { preload: false, throwOnError: false },\n );\n\n const onBeforeNavigateLastMatch = onResolvedMatchedRoutes[onResolvedMatchedRoutes.length - 1];\n\n const navigationLocation = WINDOW.location;\n const navigationSpan = startBrowserTracingNavigationSpan(client, {\n name: onBeforeNavigateLastMatch ? onBeforeNavigateLastMatch.routeId : navigationLocation.pathname,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.tanstack_router',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: onBeforeNavigateLastMatch ? 'route' : 'url',\n },\n });\n\n // In case the user is redirected during navigation we want to update the span with the right value.\n const unsubscribeOnResolved = castRouterInstance.subscribe('onResolved', onResolvedArgs => {\n unsubscribeOnResolved();\n if (navigationSpan) {\n const onResolvedMatchedRoutes = castRouterInstance.matchRoutes(\n onResolvedArgs.toLocation.pathname,\n onResolvedArgs.toLocation.search,\n { preload: false, throwOnError: false },\n );\n\n const onResolvedLastMatch = onResolvedMatchedRoutes[onResolvedMatchedRoutes.length - 1];\n\n if (onResolvedLastMatch) {\n navigationSpan.updateName(onResolvedLastMatch.routeId);\n navigationSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');\n navigationSpan.setAttributes(routeMatchToParamSpanAttributes(onResolvedLastMatch));\n }\n }\n });\n });\n }\n },\n };\n}\n\nfunction routeMatchToParamSpanAttributes(match: VendoredTanstackRouterRouteMatch | undefined): Record<string, string> {\n if (!match) {\n return {};\n }\n\n const paramAttributes: Record<string, string> = {};\n Object.entries(match.params).forEach(([key, value]) => {\n paramAttributes[`url.path.params.${key}`] = value; // TODO(v11): remove attribute which does not adhere to Sentry's semantic convention\n paramAttributes[`url.path.parameter.${key}`] = value;\n paramAttributes[`params.${key}`] = value; // params.[key] is an alias\n });\n\n return paramAttributes;\n}\n"],"names":["originalBrowserTracingIntegration"],"mappings":";;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,uCAAuC;AACvD;AACA,EAAE,MAAM;AACR,EAAE,OAAO,GAA4D,EAAE;AACvE,EAAe;AACf,EAAE,MAAM,kBAAkB,GAA2B,MAAM;;AAE3D,EAAE,MAAM,iCAAA,GAAoCA,yBAAiC,CAAC;AAC9E,IAAI,GAAG,OAAO;AACd,IAAI,oBAAoB,EAAE,KAAK;AAC/B,IAAI,kBAAkB,EAAE,KAAK;AAC7B,GAAG,CAAC;;AAEJ,EAAE,MAAM,EAAE,kBAAA,GAAqB,IAAI,EAAE,oBAAA,GAAuB,IAAA,EAAK,GAAI,OAAO;;AAE5E,EAAE,OAAO;AACT,IAAI,GAAG,iCAAiC;AACxC,IAAI,aAAa,CAAC,MAAM,EAAE;AAC1B,MAAM,iCAAiC,CAAC,aAAa,CAAC,MAAM,CAAC;;AAE7D,MAAM,MAAM,qBAAA,GAAwB,MAAM,CAAC,QAAQ;AACnD,MAAM,IAAI,kBAAA,IAAsB,qBAAqB,EAAE;AACvD,QAAQ,MAAM,aAAA,GAAgB,kBAAkB,CAAC,WAAW;AAC5D,UAAU,qBAAqB,CAAC,QAAQ;AACxC,UAAU,kBAAkB,CAAC,OAAO,CAAC,WAAW,CAAC,qBAAqB,CAAC,MAAM,CAAC;AAC9E,UAAU,EAAE,OA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CAAC,GAAG,EAAE,KAAK,CAAC,KAAK;AACzD,IAAI,eAAe,CAAC,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAA,CAAA,GAAA,KAAA,CAAA;AACA,IAAA,eAAA,CAAA,CAAA,mBAAA,EAAA,GAAA,CAAA,CAAA,CAAA,GAAA,KAAA;AACA,IAAA,eAAA,CAAA,CAAA,OAAA,EAAA,GAAA,CAAA,CAAA,CAAA,GAAA,KAAA,CAAA;AACA,EAAA,CAAA,CAAA;;AAEA,EAAA,OAAA,eAAA;AACA;;;;"}
1
+ {"version":3,"file":"tanstackrouter.js","sources":["../../src/tanstackrouter.ts"],"sourcesContent":["import {\n browserTracingIntegration as originalBrowserTracingIntegration,\n startBrowserTracingNavigationSpan,\n startBrowserTracingPageLoadSpan,\n WINDOW,\n} from '@sentry/browser';\nimport type { Integration } from '@sentry/core';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '@sentry/core';\nimport type { VendoredTanstackRouter, VendoredTanstackRouterRouteMatch } from './vendor/tanstackrouter-types';\n\n/**\n * A custom browser tracing integration for TanStack Router.\n *\n * The minimum compatible version of `@tanstack/react-router` is `1.64.0`.\n *\n * @param router A TanStack Router `Router` instance that should be used for routing instrumentation.\n * @param options Sentry browser tracing configuration.\n */\nexport function tanstackRouterBrowserTracingIntegration(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n router: any, // This is `any` because we don't want any type mismatches if TanStack Router changes their types\n options: Parameters<typeof originalBrowserTracingIntegration>[0] = {},\n): Integration {\n const castRouterInstance: VendoredTanstackRouter = router;\n\n const browserTracingIntegrationInstance = originalBrowserTracingIntegration({\n ...options,\n instrumentNavigation: false,\n instrumentPageLoad: false,\n });\n\n const { instrumentPageLoad = true, instrumentNavigation = true } = options;\n\n return {\n ...browserTracingIntegrationInstance,\n afterAllSetup(client) {\n browserTracingIntegrationInstance.afterAllSetup(client);\n\n const initialWindowLocation = WINDOW.location;\n if (instrumentPageLoad && initialWindowLocation) {\n const matchedRoutes = castRouterInstance.matchRoutes(\n initialWindowLocation.pathname,\n castRouterInstance.options.parseSearch(initialWindowLocation.search),\n { preload: false, throwOnError: false },\n );\n\n const lastMatch = matchedRoutes[matchedRoutes.length - 1];\n\n startBrowserTracingPageLoadSpan(client, {\n name: lastMatch ? lastMatch.routeId : initialWindowLocation.pathname,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.tanstack_router',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: lastMatch ? 'route' : 'url',\n ...routeMatchToParamSpanAttributes(lastMatch),\n },\n });\n }\n\n if (instrumentNavigation) {\n // The onBeforeNavigate hook is called at the very beginning of a navigation and is only called once per navigation, even when the user is redirected\n castRouterInstance.subscribe('onBeforeNavigate', onBeforeNavigateArgs => {\n // onBeforeNavigate is called during pageloads. We can avoid creating navigation spans by:\n // 1. Checking if there's no fromLocation (initial pageload)\n // 2. Comparing the states of the to and from arguments\n if (\n !onBeforeNavigateArgs.fromLocation ||\n onBeforeNavigateArgs.toLocation.state === onBeforeNavigateArgs.fromLocation.state\n ) {\n return;\n }\n\n const onResolvedMatchedRoutes = castRouterInstance.matchRoutes(\n onBeforeNavigateArgs.toLocation.pathname,\n onBeforeNavigateArgs.toLocation.search,\n { preload: false, throwOnError: false },\n );\n\n const onBeforeNavigateLastMatch = onResolvedMatchedRoutes[onResolvedMatchedRoutes.length - 1];\n\n const navigationLocation = WINDOW.location;\n const navigationSpan = startBrowserTracingNavigationSpan(client, {\n name: onBeforeNavigateLastMatch ? onBeforeNavigateLastMatch.routeId : navigationLocation.pathname,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.tanstack_router',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: onBeforeNavigateLastMatch ? 'route' : 'url',\n },\n });\n\n // In case the user is redirected during navigation we want to update the span with the right value.\n const unsubscribeOnResolved = castRouterInstance.subscribe('onResolved', onResolvedArgs => {\n unsubscribeOnResolved();\n if (navigationSpan) {\n const onResolvedMatchedRoutes = castRouterInstance.matchRoutes(\n onResolvedArgs.toLocation.pathname,\n onResolvedArgs.toLocation.search,\n { preload: false, throwOnError: false },\n );\n\n const onResolvedLastMatch = onResolvedMatchedRoutes[onResolvedMatchedRoutes.length - 1];\n\n if (onResolvedLastMatch) {\n navigationSpan.updateName(onResolvedLastMatch.routeId);\n navigationSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');\n navigationSpan.setAttributes(routeMatchToParamSpanAttributes(onResolvedLastMatch));\n }\n }\n });\n });\n }\n },\n };\n}\n\nfunction routeMatchToParamSpanAttributes(match: VendoredTanstackRouterRouteMatch | undefined): Record<string, string> {\n if (!match) {\n return {};\n }\n\n const paramAttributes: Record<string, string> = {};\n Object.entries(match.params).forEach(([key, value]) => {\n paramAttributes[`url.path.params.${key}`] = value; // TODO(v11): remove attribute which does not adhere to Sentry's semantic convention\n paramAttributes[`url.path.parameter.${key}`] = value;\n paramAttributes[`params.${key}`] = value; // params.[key] is an alias\n });\n\n return paramAttributes;\n}\n"],"names":["originalBrowserTracingIntegration"],"mappings":";;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,uCAAuC;AACvD;AACA,EAAE,MAAM;AACR,EAAE,OAAO,GAA4D,EAAE;AACvE,EAAe;AACf,EAAE,MAAM,kBAAkB,GAA2B,MAAM;;AAE3D,EAAE,MAAM,iCAAA,GAAoCA,yBAAiC,CAAC;AAC9E,IAAI,GAAG,OAAO;AACd,IAAI,oBAAoB,EAAE,KAAK;AAC/B,IAAI,kBAAkB,EAAE,KAAK;AAC7B,GAAG,CAAC;;AAEJ,EAA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,gBAAgB,cAAc,CAAC,UAAU,CAAC,mBAAmB,CAAC,OAAO,CAAC;AACtE,gBAAgB,cAAc,CAAC,YAAY,CAAC,gCAAgC,EAAE,OAAO,CAAC;AACtF,gBAAgB,cAAc,CAAC,aAAa,CAAC,+BAA+B,CAAC,mBAAmB,CAAC,CAAC;AAClG,cAAc;AACd,YAAY;AACZ,UAAU,CAAC,CAAC;AACZ,QAAQ,CAAC,CAAC;AACV,MAAM;AACN,IAAI,CAAC;AACL,GAAG;AACH;;AAEA,SAAS,+BAA+B,CAAC,KAAK,EAAwE;AACtH,EAAE,IAAI,CAAC,KAAK,EAAE;AACd,IAAI,OAAO,EAAE;AACb,EAAE;;AAEF,EAAE,MAAM,eAAe,GAA2B,EAAE;AACpD,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK;AACzD,IAAI,eAAe,CAAC,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAA,CAAA,GAAA,KAAA,CAAA;AACA,IAAA,eAAA,CAAA,CAAA,mBAAA,EAAA,GAAA,CAAA,CAAA,CAAA,GAAA,KAAA;AACA,IAAA,eAAA,CAAA,CAAA,OAAA,EAAA,GAAA,CAAA,CAAA,CAAA,GAAA,KAAA,CAAA;AACA,EAAA,CAAA,CAAA;;AAEA,EAAA,OAAA,eAAA;AACA;;;;"}
@@ -1,5 +1,5 @@
1
1
  export type { ReactRouterOptions } from './instrumentation';
2
2
  export { createReactRouterV6CompatibleTracingIntegration, createV6CompatibleWithSentryReactRouterRouting, createV6CompatibleWrapCreateBrowserRouter, createV6CompatibleWrapCreateMemoryRouter, createV6CompatibleWrapUseRoutes, handleNavigation, addResolvedRoutesToParent, processResolvedRoutes, updateNavigationSpan, } from './instrumentation';
3
- export { resolveRouteNameAndSource, getNormalizedName, initializeRouterUtils, locationIsInsideDescendantRoute, prefixWithSlash, rebuildRoutePathFromAllRoutes, pathEndsWithWildcard, pathIsWildcardAndHasChildren, getNumberOfUrlSegments, transactionNameHasWildcard, } from './utils';
3
+ export { resolveRouteNameAndSource, getNormalizedName, initializeRouterUtils, locationIsInsideDescendantRoute, prefixWithSlash, rebuildRoutePathFromAllRoutes, pathEndsWithWildcard, pathIsWildcardAndHasChildren, getNumberOfUrlSegments, transactionNameHasWildcard, getActiveRootSpan, setNavigationContext, clearNavigationContext, getNavigationContext, } from './utils';
4
4
  export { createAsyncHandlerProxy, handleAsyncHandlerResult, checkRouteForAsyncHandler } from './lazy-routes';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/reactrouter-compat-utils/index.ts"],"names":[],"mappings":"AAGA,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EACL,+CAA+C,EAC/C,8CAA8C,EAC9C,yCAAyC,EACzC,wCAAwC,EACxC,+BAA+B,EAC/B,gBAAgB,EAChB,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,qBAAqB,EACrB,+BAA+B,EAC/B,eAAe,EACf,6BAA6B,EAC7B,oBAAoB,EACpB,4BAA4B,EAC5B,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/reactrouter-compat-utils/index.ts"],"names":[],"mappings":"AAGA,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EACL,+CAA+C,EAC/C,8CAA8C,EAC9C,yCAAyC,EACzC,wCAAwC,EACxC,+BAA+B,EAC/B,gBAAgB,EAChB,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,qBAAqB,EACrB,+BAA+B,EAC/B,eAAe,EACf,6BAA6B,EAC7B,oBAAoB,EACpB,4BAA4B,EAC5B,sBAAsB,EACtB,0BAA0B,EAC1B,iBAAiB,EAEjB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC"}
@@ -63,8 +63,10 @@ type V6CompatibleVersion = '6' | '7';
63
63
  export declare function addResolvedRoutesToParent(resolvedRoutes: RouteObject[], parentRoute: RouteObject): void;
64
64
  /**
65
65
  * Processes resolved routes by adding them to allRoutes and checking for nested async handlers.
66
+ * When capturedSpan is provided, updates that specific span instead of the current active span.
67
+ * This prevents race conditions where a lazy handler resolves after the user has navigated away.
66
68
  */
67
- export declare function processResolvedRoutes(resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location | null): void;
69
+ export declare function processResolvedRoutes(resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location | null, capturedSpan?: Span): void;
68
70
  /**
69
71
  * Updates a navigation span with the correct route name after lazy routes have been loaded.
70
72
  */
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../../src/reactrouter-compat-utils/instrumentation.tsx"],"names":[],"mappings":"AAIA,OAAO,EACL,yBAAyB,EAI1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAU,WAAW,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAa9D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EACV,MAAM,EACN,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,EACxB,QAAQ,EACR,WAAW,EAEX,WAAW,EACX,MAAM,EACN,WAAW,EACX,S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from '../types';
2
3
  /**
3
4
  * Creates a proxy wrapper for an async handler function.
5
+ * Captures both the location and the active span at invocation time to ensure
6
+ * the correct span is updated when the handler resolves.
4
7
  */
5
- export declare function createAsyncHandlerProxy(originalFunction: (...args: unknown[]) => unknown, route: RouteObject, handlerKey: string, processResolvedRoutes: (resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location) => void): (...args: unknown[]) => unknown;
8
+ export declare function createAsyncHandlerProxy(originalFunction: (...args: unknown[]) => unknown, route: RouteObject, handlerKey: string, processResolvedRoutes: (resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location, capturedSpan?: Span) => void): (...args: unknown[]) => unknown;
6
9
  /**
7
10
  * Handles the result of an async handler function call.
11
+ * Passes the captured span through to ensure the correct span is updated.
8
12
  */
9
- export declare function handleAsyncHandlerResult(result: unknown, route: RouteObject, handlerKey: string, processResolvedRoutes: (resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location) => void): void;
13
+ export declare function handleAsyncHandlerResult(result: unknown, route: RouteObject, handlerKey: string, processResolvedRoutes: (resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location, capturedSpan?: Span) => void, currentLocation: Location | null, capturedSpan: Span | undefined): void;
10
14
  /**
11
15
  * Recursively checks a route for async handlers and sets up Proxies to add discovered child routes to allRoutes when called.
12
16
  */
13
- export declare function checkRouteForAsyncHandler(route: RouteObject, processResolvedRoutes: (resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location) => void): void;
17
+ export declare function checkRouteForAsyncHandler(route: RouteObject, processResolvedRoutes: (resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location, capturedSpan?: Span) => void): void;
14
18
  //# sourceMappingURL=lazy-routes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lazy-routes.d.ts","sourceRoot":"","sources":["../../../src/reactrouter-compat-utils/lazy-routes.tsx"],"names":[],"mappings":"AAEA,OAAO,KA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E,CACrB,cAAc,EAAE,WAAW,EAAE,EAC7B,WAAW,CAAC,EAAE,WAAW,EACzB,eAAe,CAAC,EAAE,QAAQ,EAC1B,YAAY,CAAC,EAAE,IAAI,KAChB,IAAI,GACR,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAqBjC;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,OAAO,EACf,KAAK,EAAE,WAAW,EAClB,UAAU,EAAE,MAAM,EAClB,qBAAqB,EAAE,CACrB,cAAc,EAAE,WAAW,EAAE,EAC7B,WAAW,CAAC,EAAE,WAAW,EACzB,eAAe,CAAC,EAAE,QAAQ,EAC1B,YAAY,CAAC,EAAE,IAAI,KAChB,IAAI,EACT,eAAe,EAAE,QAAQ,GAAG,IAAI,EAChC,YAAY,EAAE,IAAI,GAAG,SAAS,GAC7B,IAAI,CAcN;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,WAAW,EAClB,qBAAqB,EAAE,CACrB,cAAc,EAAE,WAAW,EAAE,EAC7B,WAAW,CAAC,EAAE,WAAW,EACzB,eAAe,CAAC,EAAE,QAAQ,EAC1B,YAAY,CAAC,EAAE,IAAI,KAChB,IAAI,GACR,IAAI,CAiBN"}
@@ -1,5 +1,23 @@
1
- import type { TransactionSource } from '@sentry/core';
1
+ import type { Span, TransactionSource } from '@sentry/core';
2
2
  import type { Location, MatchRoutes, RouteMatch, RouteObject } from '../types';
3
+ interface NavigationContext {
4
+ token: object;
5
+ targetPath: string | undefined;
6
+ span: Span | undefined;
7
+ }
8
+ /**
9
+ * Pushes a navigation context and returns a unique token for cleanup.
10
+ * The token uses object identity for uniqueness (no counter needed).
11
+ */
12
+ export declare function setNavigationContext(targetPath: string | undefined, span: Span | undefined): object;
13
+ /**
14
+ * Clears the navigation context if it's on top of the stack (LIFO).
15
+ * If our context is not on top (out-of-order completion), we leave it -
16
+ * it will be cleaned up by overflow protection when the stack fills up.
17
+ */
18
+ export declare function clearNavigationContext(token: object): void;
19
+ /** Gets the current (most recent) navigation context if inside a patchRoutesOnNavigation call. */
20
+ export declare function getNavigationContext(): NavigationContext | null;
3
21
  /**
4
22
  * Initialize function to set dependencies that the router utilities need.
5
23
  * Must be called before using any of the exported utility functions.
@@ -45,4 +63,9 @@ export declare function getNormalizedName(routes: RouteObject[], location: Locat
45
63
  * Shared helper function to resolve route name and source
46
64
  */
47
65
  export declare function resolveRouteNameAndSource(location: Location, routes: RouteObject[], allRoutes: RouteObject[], branches: RouteMatch[], basename?: string): [string, TransactionSource];
66
+ /**
67
+ * Gets the active root span if it's a pageload or navigation span.
68
+ */
69
+ export declare function getActiveRootSpan(): Span | undefined;
70
+ export {};
48
71
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/reactrouter-compat-utils/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAM/E;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,WAAW,EAAE,aAAa,GAAE,OAAe,GAAG,IAAI,CAGpG;AAmBD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,mEAAmE;AACnE,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,OAAO,CAE9F;AAED,uEAAuE;AACvE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAE7D;AAsBD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,GA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;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,WAAW,EAAE,EACrB,SAAS,EAAE,WAAW,EAAE,EACxB,QAAQ,EAAE,UAAU,EAAE,EACtB,QAAQ,GAAE,MAAW,GACpB,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAgB7B;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,GAAG,SAAS,CAYpD"}
@@ -1 +1 @@
1
- {"version":3,"file":"tanstackrouter.d.ts","sourceRoot":"","sources":["../../src/tanstackrouter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,IAAI,iCAAiC,EAI/D,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAQhD;;;;;;;GAOG;AACH,wBAAgB,uCAAuC,CAErD,MAAM,EAAE,GAAG,EAAE,iGAAiG;AAC9G,OAAO,GAAE,UAAU,CAAC,OAAO,iCAAiC,CAAC,CAAC,CAAC,CAAM,GACpE,WAAW,CAsFb"}
1
+ {"version":3,"file":"tanstackrouter.d.ts","sourceRoot":"","sources":["../../src/tanstackrouter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,IAAI,iCAAiC,EAI/D,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAQhD;;;;;;;GAOG;AACH,wBAAgB,uCAAuC,CAErD,MAAM,EAAE,GAAG,EAAE,iGAAiG;AAC9G,OAAO,GAAE,UAAU,CAAC,OAAO,iCAAiC,CAAC,CAAC,CAAC,CAAM,GACpE,WAAW,CA2Fb"}
@@ -1,5 +1,5 @@
1
1
  export { ReactRouterOptions } from './instrumentation';
2
2
  export { createReactRouterV6CompatibleTracingIntegration, createV6CompatibleWithSentryReactRouterRouting, createV6CompatibleWrapCreateBrowserRouter, createV6CompatibleWrapCreateMemoryRouter, createV6CompatibleWrapUseRoutes, handleNavigation, addResolvedRoutesToParent, processResolvedRoutes, updateNavigationSpan, } from './instrumentation';
3
- export { resolveRouteNameAndSource, getNormalizedName, initializeRouterUtils, locationIsInsideDescendantRoute, prefixWithSlash, rebuildRoutePathFromAllRoutes, pathEndsWithWildcard, pathIsWildcardAndHasChildren, getNumberOfUrlSegments, transactionNameHasWildcard, } from './utils';
3
+ export { resolveRouteNameAndSource, getNormalizedName, initializeRouterUtils, locationIsInsideDescendantRoute, prefixWithSlash, rebuildRoutePathFromAllRoutes, pathEndsWithWildcard, pathIsWildcardAndHasChildren, getNumberOfUrlSegments, transactionNameHasWildcard, getActiveRootSpan, setNavigationContext, clearNavigationContext, getNavigationContext, } from './utils';
4
4
  export { createAsyncHandlerProxy, handleAsyncHandlerResult, checkRouteForAsyncHandler } from './lazy-routes';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -63,8 +63,10 @@ type V6CompatibleVersion = '6' | '7';
63
63
  export declare function addResolvedRoutesToParent(resolvedRoutes: RouteObject[], parentRoute: RouteObject): void;
64
64
  /**
65
65
  * Processes resolved routes by adding them to allRoutes and checking for nested async handlers.
66
+ * When capturedSpan is provided, updates that specific span instead of the current active span.
67
+ * This prevents race conditions where a lazy handler resolves after the user has navigated away.
66
68
  */
67
- export declare function processResolvedRoutes(resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location | null): void;
69
+ export declare function processResolvedRoutes(resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location | null, capturedSpan?: Span): void;
68
70
  /**
69
71
  * Updates a navigation span with the correct route name after lazy routes have been loaded.
70
72
  */
@@ -1,14 +1,18 @@
1
+ import { Span } from '@sentry/core';
1
2
  import { Location, RouteObject } from '../types';
2
3
  /**
3
4
  * Creates a proxy wrapper for an async handler function.
5
+ * Captures both the location and the active span at invocation time to ensure
6
+ * the correct span is updated when the handler resolves.
4
7
  */
5
- export declare function createAsyncHandlerProxy(originalFunction: (...args: unknown[]) => unknown, route: RouteObject, handlerKey: string, processResolvedRoutes: (resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location) => void): (...args: unknown[]) => unknown;
8
+ export declare function createAsyncHandlerProxy(originalFunction: (...args: unknown[]) => unknown, route: RouteObject, handlerKey: string, processResolvedRoutes: (resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location, capturedSpan?: Span) => void): (...args: unknown[]) => unknown;
6
9
  /**
7
10
  * Handles the result of an async handler function call.
11
+ * Passes the captured span through to ensure the correct span is updated.
8
12
  */
9
- export declare function handleAsyncHandlerResult(result: unknown, route: RouteObject, handlerKey: string, processResolvedRoutes: (resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location) => void): void;
13
+ export declare function handleAsyncHandlerResult(result: unknown, route: RouteObject, handlerKey: string, processResolvedRoutes: (resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location, capturedSpan?: Span) => void, currentLocation: Location | null, capturedSpan: Span | undefined): void;
10
14
  /**
11
15
  * Recursively checks a route for async handlers and sets up Proxies to add discovered child routes to allRoutes when called.
12
16
  */
13
- export declare function checkRouteForAsyncHandler(route: RouteObject, processResolvedRoutes: (resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location) => void): void;
17
+ export declare function checkRouteForAsyncHandler(route: RouteObject, processResolvedRoutes: (resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location, capturedSpan?: Span) => void): void;
14
18
  //# sourceMappingURL=lazy-routes.d.ts.map
@@ -1,5 +1,23 @@
1
- import { TransactionSource } from '@sentry/core';
1
+ import { Span, TransactionSource } from '@sentry/core';
2
2
  import { Location, MatchRoutes, RouteMatch, RouteObject } from '../types';
3
+ interface NavigationContext {
4
+ token: object;
5
+ targetPath: string | undefined;
6
+ span: Span | undefined;
7
+ }
8
+ /**
9
+ * Pushes a navigation context and returns a unique token for cleanup.
10
+ * The token uses object identity for uniqueness (no counter needed).
11
+ */
12
+ export declare function setNavigationContext(targetPath: string | undefined, span: Span | undefined): object;
13
+ /**
14
+ * Clears the navigation context if it's on top of the stack (LIFO).
15
+ * If our context is not on top (out-of-order completion), we leave it -
16
+ * it will be cleaned up by overflow protection when the stack fills up.
17
+ */
18
+ export declare function clearNavigationContext(token: object): void;
19
+ /** Gets the current (most recent) navigation context if inside a patchRoutesOnNavigation call. */
20
+ export declare function getNavigationContext(): NavigationContext | null;
3
21
  /**
4
22
  * Initialize function to set dependencies that the router utilities need.
5
23
  * Must be called before using any of the exported utility functions.
@@ -51,4 +69,9 @@ export declare function resolveRouteNameAndSource(location: Location, routes: Ro
51
69
  string,
52
70
  TransactionSource
53
71
  ];
72
+ /**
73
+ * Gets the active root span if it's a pageload or navigation span.
74
+ */
75
+ export declare function getActiveRootSpan(): Span | undefined;
76
+ export {};
54
77
  //# sourceMappingURL=utils.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/react",
3
- "version": "10.29.0",
3
+ "version": "10.31.0",
4
4
  "description": "Official Sentry SDK for React.js",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/react",
@@ -39,8 +39,8 @@
39
39
  "access": "public"
40
40
  },
41
41
  "dependencies": {
42
- "@sentry/browser": "10.29.0",
43
- "@sentry/core": "10.29.0",
42
+ "@sentry/browser": "10.31.0",
43
+ "@sentry/core": "10.31.0",
44
44
  "hoist-non-react-statics": "^3.3.2"
45
45
  },
46
46
  "peerDependencies": {