@depup/sentry__react 10.75.2-depup.0 → 11.0.0-depup.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 (119) hide show
  1. package/README.md +3 -3
  2. package/build/cjs/error.js +4 -10
  3. package/build/cjs/error.js.map +1 -1
  4. package/build/cjs/hoist-non-react-statics.js +1 -7
  5. package/build/cjs/hoist-non-react-statics.js.map +1 -1
  6. package/build/cjs/profiler.js +45 -19
  7. package/build/cjs/profiler.js.map +1 -1
  8. package/build/cjs/react-router.js +21 -0
  9. package/build/cjs/react-router.js.map +1 -0
  10. package/build/cjs/reactrouter-compat-utils/instrumentation.js +200 -192
  11. package/build/cjs/reactrouter-compat-utils/instrumentation.js.map +1 -1
  12. package/build/cjs/reactrouter-compat-utils/route-manifest.js +4 -4
  13. package/build/cjs/reactrouter-compat-utils/route-manifest.js.map +1 -1
  14. package/build/cjs/reactrouter-compat-utils/utils.js +34 -37
  15. package/build/cjs/reactrouter-compat-utils/utils.js.map +1 -1
  16. package/build/cjs/reactrouter.compat.js +0 -3
  17. package/build/cjs/reactrouter.compat.js.map +1 -1
  18. package/build/cjs/reactrouter.js +14 -8
  19. package/build/cjs/reactrouter.js.map +1 -1
  20. package/build/cjs/reactrouterv3.js +12 -9
  21. package/build/cjs/reactrouterv3.js.map +1 -1
  22. package/build/cjs/reactrouterv6.js +0 -3
  23. package/build/cjs/reactrouterv6.js.map +1 -1
  24. package/build/cjs/reactrouterv7.js +0 -3
  25. package/build/cjs/reactrouterv7.js.map +1 -1
  26. package/build/cjs/redux.js +6 -6
  27. package/build/cjs/redux.js.map +1 -1
  28. package/build/cjs/sdk.js +7 -7
  29. package/build/cjs/sdk.js.map +1 -1
  30. package/build/cjs/tanstackrouter.js +23 -13
  31. package/build/cjs/tanstackrouter.js.map +1 -1
  32. package/build/esm/error.js +3 -8
  33. package/build/esm/error.js.map +1 -1
  34. package/build/esm/hoist-non-react-statics.js +1 -7
  35. package/build/esm/hoist-non-react-statics.js.map +1 -1
  36. package/build/esm/package.json +1 -1
  37. package/build/esm/profiler.js +47 -21
  38. package/build/esm/profiler.js.map +1 -1
  39. package/build/esm/react-router.js +16 -0
  40. package/build/esm/react-router.js.map +1 -0
  41. package/build/esm/reactrouter-compat-utils/instrumentation.js +203 -195
  42. package/build/esm/reactrouter-compat-utils/instrumentation.js.map +1 -1
  43. package/build/esm/reactrouter-compat-utils/route-manifest.js +1 -1
  44. package/build/esm/reactrouter-compat-utils/route-manifest.js.map +1 -1
  45. package/build/esm/reactrouter-compat-utils/utils.js +32 -34
  46. package/build/esm/reactrouter-compat-utils/utils.js.map +1 -1
  47. package/build/esm/reactrouter.compat.js +0 -3
  48. package/build/esm/reactrouter.compat.js.map +1 -1
  49. package/build/esm/reactrouter.js +16 -10
  50. package/build/esm/reactrouter.js.map +1 -1
  51. package/build/esm/reactrouterv3.js +11 -8
  52. package/build/esm/reactrouterv3.js.map +1 -1
  53. package/build/esm/reactrouterv6.js +0 -3
  54. package/build/esm/reactrouterv6.js.map +1 -1
  55. package/build/esm/reactrouterv7.js +0 -3
  56. package/build/esm/reactrouterv7.js.map +1 -1
  57. package/build/esm/redux.js +1 -1
  58. package/build/esm/redux.js.map +1 -1
  59. package/build/esm/sdk.js +1 -1
  60. package/build/esm/sdk.js.map +1 -1
  61. package/build/esm/tanstackrouter.js +23 -13
  62. package/build/esm/tanstackrouter.js.map +1 -1
  63. package/build/types/error.d.ts +0 -4
  64. package/build/types/error.d.ts.map +1 -1
  65. package/build/types/errorboundary.d.ts.map +1 -1
  66. package/build/types/hoist-non-react-statics.d.ts.map +1 -1
  67. package/build/types/profiler.d.ts +0 -1
  68. package/build/types/profiler.d.ts.map +1 -1
  69. package/build/types/react-router.d.ts +26 -0
  70. package/build/types/react-router.d.ts.map +1 -0
  71. package/build/types/reactrouter-compat-utils/index.d.ts +1 -1
  72. package/build/types/reactrouter-compat-utils/index.d.ts.map +1 -1
  73. package/build/types/reactrouter-compat-utils/instrumentation.d.ts +9 -5
  74. package/build/types/reactrouter-compat-utils/instrumentation.d.ts.map +1 -1
  75. package/build/types/reactrouter-compat-utils/utils.d.ts +6 -11
  76. package/build/types/reactrouter-compat-utils/utils.d.ts.map +1 -1
  77. package/build/types/reactrouter.d.ts +16 -0
  78. package/build/types/reactrouter.d.ts.map +1 -1
  79. package/build/types/reactrouterv3.d.ts +1 -1
  80. package/build/types/reactrouterv3.d.ts.map +1 -1
  81. package/build/types/redux.d.ts +1 -1
  82. package/build/types/redux.d.ts.map +1 -1
  83. package/build/types/sdk.d.ts +1 -1
  84. package/build/types/sdk.d.ts.map +1 -1
  85. package/build/types/tanstackrouter.d.ts +1 -1
  86. package/build/types/tanstackrouter.d.ts.map +1 -1
  87. package/build/types/types.d.ts +16 -0
  88. package/build/types/types.d.ts.map +1 -1
  89. package/changes.json +3 -3
  90. package/package.json +39 -21
  91. package/build/cjs/constants.js +0 -10
  92. package/build/cjs/constants.js.map +0 -1
  93. package/build/esm/constants.js +0 -6
  94. package/build/esm/constants.js.map +0 -1
  95. package/build/types/constants.d.ts +0 -4
  96. package/build/types/constants.d.ts.map +0 -1
  97. package/build/types-ts3.8/constants.d.ts +0 -4
  98. package/build/types-ts3.8/debug-build.d.ts +0 -7
  99. package/build/types-ts3.8/error.d.ts +0 -41
  100. package/build/types-ts3.8/errorboundary.d.ts +0 -87
  101. package/build/types-ts3.8/hoist-non-react-statics.d.ts +0 -21
  102. package/build/types-ts3.8/index.d.ts +0 -14
  103. package/build/types-ts3.8/isSyntheticEvent.d.ts +0 -10
  104. package/build/types-ts3.8/profiler.d.ts +0 -56
  105. package/build/types-ts3.8/reactrouter-compat-utils/index.d.ts +0 -5
  106. package/build/types-ts3.8/reactrouter-compat-utils/instrumentation.d.ts +0 -117
  107. package/build/types-ts3.8/reactrouter-compat-utils/lazy-routes.d.ts +0 -18
  108. package/build/types-ts3.8/reactrouter-compat-utils/route-manifest.d.ts +0 -13
  109. package/build/types-ts3.8/reactrouter-compat-utils/utils.d.ts +0 -77
  110. package/build/types-ts3.8/reactrouter.compat.d.ts +0 -42
  111. package/build/types-ts3.8/reactrouter.d.ts +0 -41
  112. package/build/types-ts3.8/reactrouterv3.d.ts +0 -29
  113. package/build/types-ts3.8/reactrouterv6.d.ts +0 -42
  114. package/build/types-ts3.8/reactrouterv7.d.ts +0 -42
  115. package/build/types-ts3.8/redux.d.ts +0 -38
  116. package/build/types-ts3.8/sdk.d.ts +0 -7
  117. package/build/types-ts3.8/tanstackrouter.d.ts +0 -13
  118. package/build/types-ts3.8/types.d.ts +0 -163
  119. package/build/types-ts3.8/vendor/tanstackrouter-types.d.ts +0 -38
@@ -8,17 +8,12 @@ const hoistNonReactStatics = require('../hoist-non-react-statics.js');
8
8
  const lazyRoutes = require('./lazy-routes.js');
9
9
  const utils = require('./utils.js');
10
10
  const attributes = require('@sentry/conventions/attributes');
11
+ const op = require('@sentry/conventions/op');
11
12
 
12
- let _useEffect;
13
- let _useLocation;
14
- let _useNavigationType;
15
- let _createRoutesFromChildren;
16
- let _matchRoutes;
17
- let _enableAsyncRouteHandlers = false;
18
- let _lazyRouteTimeout = 3e3;
19
- let _lazyRouteManifest;
20
- let _basename = "";
21
- const CLIENTS_WITH_INSTRUMENT_NAVIGATION = /* @__PURE__ */ new WeakSet();
13
+ const reactRouterConfigByClient = /* @__PURE__ */ new WeakMap();
14
+ function getRouterConfig(client) {
15
+ return client ? reactRouterConfigByClient.get(client) : void 0;
16
+ }
22
17
  const useIsomorphicLayoutEffect = browser.WINDOW?.document ? React.useLayoutEffect : React.useEffect;
23
18
  const activeNavigationSpans = /* @__PURE__ */ new WeakMap();
24
19
  const allRoutes = /* @__PURE__ */ new Set();
@@ -102,11 +97,11 @@ function resolveDeferredLazyRoutePromise(span) {
102
97
  }
103
98
  }
104
99
  }
105
- function processResolvedRoutes(resolvedRoutes, parentRoute, currentLocation = null, capturedSpan) {
100
+ function processResolvedRoutes(resolvedRoutes, config, parentRoute, currentLocation = null, capturedSpan) {
106
101
  resolvedRoutes.forEach((child) => {
107
102
  allRoutes.add(child);
108
- if (_enableAsyncRouteHandlers) {
109
- lazyRoutes.checkRouteForAsyncHandler(child, processResolvedRoutes);
103
+ if (config.enableAsyncRouteHandlers) {
104
+ lazyRoutes.checkRouteForAsyncHandler(child, (r, p, l, s) => processResolvedRoutes(r, config, p, l, s));
110
105
  }
111
106
  });
112
107
  if (parentRoute) {
@@ -114,12 +109,12 @@ function processResolvedRoutes(resolvedRoutes, parentRoute, currentLocation = nu
114
109
  }
115
110
  const targetSpan = capturedSpan ?? utils.getActiveRootSpan();
116
111
  if (targetSpan) {
117
- const spanJson = core.spanToJSON(targetSpan);
118
- if (spanJson.timestamp) {
112
+ const { end_timestamp, attributes: attributes$1 } = core.spanToJSON(targetSpan);
113
+ if (end_timestamp) {
119
114
  debugBuild.DEBUG_BUILD && core.debug.warn("[React Router] Lazy handler resolved after span ended - skipping update");
120
115
  return;
121
116
  }
122
- const spanOp = spanJson.op;
117
+ const spanOp = attributes$1[attributes.SENTRY_OP];
123
118
  let location = currentLocation;
124
119
  if (!location && !capturedSpan) {
125
120
  if (typeof browser.WINDOW !== "undefined") {
@@ -135,62 +130,65 @@ function processResolvedRoutes(resolvedRoutes, parentRoute, currentLocation = nu
135
130
  activeRootSpan: targetSpan,
136
131
  location: { pathname: location.pathname },
137
132
  routes: Array.from(allRoutes),
138
- allRoutes: Array.from(allRoutes)
133
+ allRoutes: Array.from(allRoutes),
134
+ config
139
135
  });
140
136
  } else if (spanOp === "navigation") {
141
- updateNavigationSpan(targetSpan, location, Array.from(allRoutes), false, _matchRoutes);
137
+ updateNavigationSpan(targetSpan, location, Array.from(allRoutes), false, config);
142
138
  }
143
139
  }
144
140
  }
145
141
  }
146
- function updateNavigationSpan(activeRootSpan, location, allRoutes2, forceUpdate = false, matchRoutes) {
147
- const spanJson = core.spanToJSON(activeRootSpan);
148
- const currentName = spanJson.description;
142
+ function updateNavigationSpan(activeRootSpan, location, allRoutes2, forceUpdate = false, config) {
143
+ const { name: currentName, end_timestamp, attributes: attributes$1 } = core.spanToJSON(activeRootSpan);
144
+ const spanPathname = activeRootSpan?.__sentry_navigation_pathname__;
145
+ if (spanPathname !== void 0 && spanPathname !== location.pathname) {
146
+ debugBuild.DEBUG_BUILD && core.debug.log(
147
+ `[React Router] Not renaming the navigation span for "${spanPathname}" with the route of "${location.pathname}"`
148
+ );
149
+ return;
150
+ }
149
151
  const hasBeenNamed = activeRootSpan?.__sentry_navigation_name_set__;
150
152
  const currentNameHasWildcard = currentName && utils.transactionNameHasWildcard(currentName);
151
153
  const shouldUpdate = !hasBeenNamed || forceUpdate || currentNameHasWildcard;
152
- if (shouldUpdate && !spanJson.timestamp) {
153
- const currentBranches = matchRoutes(allRoutes2, location);
154
+ if (shouldUpdate && !end_timestamp) {
155
+ const currentBranches = config.matchRoutes(allRoutes2, location);
154
156
  const [name, source] = utils.resolveRouteNameAndSource(
155
157
  location,
156
158
  allRoutes2,
157
159
  allRoutes2,
158
160
  currentBranches || [],
159
- _basename,
160
- _lazyRouteManifest,
161
- _enableAsyncRouteHandlers
161
+ config
162
162
  );
163
- const currentSource = spanJson.data?.[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];
163
+ const currentSource = attributes$1[attributes.SENTRY_SEGMENT_NAME_SOURCE];
164
164
  const isImprovement = name && (!currentName || // No current name - always set
165
165
  !hasBeenNamed && (currentSource !== "route" || source === "route") || // Not finalized - allow unless downgrading route→url
166
166
  currentSource !== "route" && source === "route" || // URL → route upgrade
167
167
  currentSource === "route" && source === "route" && currentNameHasWildcard);
168
168
  if (isImprovement) {
169
- activeRootSpan.updateName(name);
170
- activeRootSpan.setAttribute(core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);
169
+ const client = core.getClient();
170
+ const isUnparameterizedStreamedNavigation = source !== "route" && !!client && core.hasSpanStreamingEnabled(client);
171
+ activeRootSpan.updateName(isUnparameterizedStreamedNavigation ? core.NAVIGATION_SPAN_NAME_FALLBACK : name);
172
+ activeRootSpan.setAttribute(attributes.SENTRY_SEGMENT_NAME_SOURCE, source);
171
173
  if (source === "route") {
172
174
  activeRootSpan.setAttribute(attributes.URL_TEMPLATE, name);
173
175
  }
174
176
  if (!utils.transactionNameHasWildcard(name) && source === "route") {
175
- core.addNonEnumerableProperty(
176
- activeRootSpan,
177
- "__sentry_navigation_name_set__",
178
- true
179
- );
177
+ core.addNonEnumerableProperty(activeRootSpan, "__sentry_navigation_name_set__", true);
180
178
  }
181
179
  }
182
180
  }
183
181
  }
184
- function setupRouterSubscription(router, routes, version, basename, activeRootSpan) {
182
+ function setupRouterSubscription(router, routes, version, activeRootSpan, config) {
185
183
  let isInitialPageloadComplete = false;
186
- let hasSeenPageloadSpan = !!activeRootSpan && core.spanToJSON(activeRootSpan).op === "pageload";
184
+ let hasSeenPageloadSpan = !!activeRootSpan && core.spanToJSON(activeRootSpan).attributes[attributes.SENTRY_OP] === "pageload";
187
185
  let hasSeenPopAfterPageload = false;
188
186
  let scheduledNavigationHandler = null;
189
187
  let lastHandledPathname = null;
190
188
  router.subscribe((state) => {
191
189
  if (!isInitialPageloadComplete) {
192
190
  const currentRootSpan = utils.getActiveRootSpan();
193
- const isCurrentlyInPageload = currentRootSpan && core.spanToJSON(currentRootSpan).op === "pageload";
191
+ const isCurrentlyInPageload = currentRootSpan && core.spanToJSON(currentRootSpan).attributes[attributes.SENTRY_OP] === "pageload";
194
192
  if (isCurrentlyInPageload) {
195
193
  hasSeenPageloadSpan = true;
196
194
  } else if (hasSeenPageloadSpan) {
@@ -215,8 +213,8 @@ function setupRouterSubscription(router, routes, version, basename, activeRootSp
215
213
  routes,
216
214
  navigationType: state.historyAction,
217
215
  version,
218
- basename,
219
- allRoutes: Array.from(allRoutes)
216
+ allRoutes: Array.from(allRoutes),
217
+ config
220
218
  });
221
219
  };
222
220
  if (state.navigation.state !== "idle") {
@@ -238,73 +236,66 @@ function setupRouterSubscription(router, routes, version, basename, activeRootSp
238
236
  });
239
237
  }
240
238
  function createV6CompatibleWrapCreateBrowserRouter(createRouterFunction, version) {
241
- if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes) {
242
- debugBuild.DEBUG_BUILD && core.debug.warn(
243
- `reactRouter${version ? `V${version}` : ""}Instrumentation was unable to wrap the \`createRouter\` function because of one or more missing parameters.`
244
- );
245
- return createRouterFunction;
246
- }
247
239
  return function(routes, opts) {
240
+ const base = getRouterConfig(core.getClient());
241
+ if (!base) {
242
+ debugBuild.DEBUG_BUILD && core.debug.warn(
243
+ `reactRouter${version ? `V${version}` : ""}Instrumentation was unable to wrap the \`createRouter\` function because the React Router browser tracing integration was not set up. Make sure \`Sentry.init()\` runs before the router is created.`
244
+ );
245
+ return createRouterFunction(routes, opts);
246
+ }
247
+ const config = { ...base, basename: opts?.basename || "" };
248
248
  addRoutesToAllRoutes(routes);
249
- if (_enableAsyncRouteHandlers) {
249
+ if (config.enableAsyncRouteHandlers) {
250
250
  for (const route of routes) {
251
- lazyRoutes.checkRouteForAsyncHandler(route, processResolvedRoutes);
251
+ lazyRoutes.checkRouteForAsyncHandler(route, (r, p, l, s) => processResolvedRoutes(r, config, p, l, s));
252
252
  }
253
253
  }
254
254
  const activeRootSpan = utils.getActiveRootSpan();
255
255
  const hasPatchRoutesOnNavigation = opts && "patchRoutesOnNavigation" in opts && typeof opts.patchRoutesOnNavigation === "function";
256
256
  if (hasPatchRoutesOnNavigation && activeRootSpan) {
257
- core.addNonEnumerableProperty(
258
- activeRootSpan,
259
- "__sentry_may_have_lazy_routes__",
260
- true
261
- );
257
+ core.addNonEnumerableProperty(activeRootSpan, "__sentry_may_have_lazy_routes__", true);
262
258
  createDeferredLazyRoutePromise(activeRootSpan);
263
259
  }
264
- const wrappedOpts = wrapPatchRoutesOnNavigation(opts, false, activeRootSpan);
260
+ const wrappedOpts = wrapPatchRoutesOnNavigation(opts, false, activeRootSpan, config);
265
261
  const router = createRouterFunction(routes, wrappedOpts);
266
- const basename = opts?.basename;
267
262
  if (router.state.historyAction === "POP" && activeRootSpan) {
268
263
  updatePageloadTransaction({
269
264
  activeRootSpan,
270
265
  location: router.state.location,
271
266
  routes,
272
- basename,
273
- allRoutes: Array.from(allRoutes)
267
+ allRoutes: Array.from(allRoutes),
268
+ config
274
269
  });
275
270
  }
276
- _basename = basename || "";
277
- setupRouterSubscription(router, routes, version, basename, activeRootSpan);
271
+ setupRouterSubscription(router, routes, version, activeRootSpan, config);
278
272
  return router;
279
273
  };
280
274
  }
281
275
  function createV6CompatibleWrapCreateMemoryRouter(createRouterFunction, version) {
282
- if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes) {
283
- debugBuild.DEBUG_BUILD && core.debug.warn(
284
- `reactRouter${version ? `V${version}` : ""}Instrumentation was unable to wrap the \`createMemoryRouter\` function because of one or more missing parameters.`
285
- );
286
- return createRouterFunction;
287
- }
288
276
  return function(routes, opts) {
277
+ const base = getRouterConfig(core.getClient());
278
+ if (!base) {
279
+ debugBuild.DEBUG_BUILD && core.debug.warn(
280
+ `reactRouter${version ? `V${version}` : ""}Instrumentation was unable to wrap the \`createMemoryRouter\` function because the React Router browser tracing integration was not set up. Make sure \`Sentry.init()\` runs before the router is created.`
281
+ );
282
+ return createRouterFunction(routes, opts);
283
+ }
284
+ const config = { ...base, basename: opts?.basename || "" };
289
285
  addRoutesToAllRoutes(routes);
290
- if (_enableAsyncRouteHandlers) {
286
+ if (config.enableAsyncRouteHandlers) {
291
287
  for (const route of routes) {
292
- lazyRoutes.checkRouteForAsyncHandler(route, processResolvedRoutes);
288
+ lazyRoutes.checkRouteForAsyncHandler(route, (r, p, l, s) => processResolvedRoutes(r, config, p, l, s));
293
289
  }
294
290
  }
295
291
  const memoryActiveRootSpanEarly = utils.getActiveRootSpan();
296
292
  const hasPatchRoutesOnNavigation = opts && "patchRoutesOnNavigation" in opts && typeof opts.patchRoutesOnNavigation === "function";
297
293
  if (hasPatchRoutesOnNavigation && memoryActiveRootSpanEarly) {
298
- core.addNonEnumerableProperty(
299
- memoryActiveRootSpanEarly,
300
- "__sentry_may_have_lazy_routes__",
301
- true
302
- );
294
+ core.addNonEnumerableProperty(memoryActiveRootSpanEarly, "__sentry_may_have_lazy_routes__", true);
303
295
  createDeferredLazyRoutePromise(memoryActiveRootSpanEarly);
304
296
  }
305
- const wrappedOpts = wrapPatchRoutesOnNavigation(opts, true, memoryActiveRootSpanEarly);
297
+ const wrappedOpts = wrapPatchRoutesOnNavigation(opts, true, memoryActiveRootSpanEarly, config);
306
298
  const router = createRouterFunction(routes, wrappedOpts);
307
- const basename = opts?.basename;
308
299
  let initialEntry = void 0;
309
300
  const initialEntries = opts?.initialEntries;
310
301
  const initialIndex = opts?.initialIndex;
@@ -318,19 +309,17 @@ function createV6CompatibleWrapCreateMemoryRouter(createRouterFunction, version)
318
309
  activeRootSpan: memoryActiveRootSpan,
319
310
  location,
320
311
  routes,
321
- basename,
322
- allRoutes: Array.from(allRoutes)
312
+ allRoutes: Array.from(allRoutes),
313
+ config
323
314
  });
324
315
  }
325
- _basename = basename || "";
326
- setupRouterSubscription(router, routes, version, basename, memoryActiveRootSpan);
316
+ setupRouterSubscription(router, routes, version, memoryActiveRootSpan, config);
327
317
  return router;
328
318
  };
329
319
  }
330
320
  function createReactRouterV6CompatibleTracingIntegration(options, version) {
331
321
  const integration = browser.browserTracingIntegration({ ...options, instrumentPageLoad: false, instrumentNavigation: false });
332
322
  const {
333
- useEffect,
334
323
  useLocation,
335
324
  useNavigationType,
336
325
  createRoutesFromChildren,
@@ -342,15 +331,14 @@ function createReactRouterV6CompatibleTracingIntegration(options, version) {
342
331
  lazyRouteTimeout,
343
332
  lazyRouteManifest
344
333
  } = options;
345
- return {
346
- ...integration,
334
+ return core.extendIntegration(integration, {
347
335
  setup(client) {
348
- integration.setup(client);
349
336
  const finalTimeout = options.finalTimeout ?? 3e4;
350
337
  const defaultMaxWait = (options.idleTimeout ?? 1e3) * 3;
351
338
  const configuredMaxWait = lazyRouteTimeout ?? defaultMaxWait;
339
+ let resolvedLazyRouteTimeout;
352
340
  if (configuredMaxWait === Infinity) {
353
- _lazyRouteTimeout = finalTimeout;
341
+ resolvedLazyRouteTimeout = finalTimeout;
354
342
  debugBuild.DEBUG_BUILD && core.debug.log(
355
343
  "[React Router] lazyRouteTimeout set to Infinity, capping at finalTimeout:",
356
344
  finalTimeout,
@@ -358,7 +346,7 @@ function createReactRouterV6CompatibleTracingIntegration(options, version) {
358
346
  );
359
347
  } else if (Number.isNaN(configuredMaxWait)) {
360
348
  debugBuild.DEBUG_BUILD && core.debug.warn("[React Router] lazyRouteTimeout must be a number, falling back to default:", defaultMaxWait);
361
- _lazyRouteTimeout = defaultMaxWait;
349
+ resolvedLazyRouteTimeout = defaultMaxWait;
362
350
  } else if (configuredMaxWait < 0) {
363
351
  debugBuild.DEBUG_BUILD && core.debug.warn(
364
352
  "[React Router] lazyRouteTimeout must be non-negative or Infinity, got:",
@@ -366,51 +354,51 @@ function createReactRouterV6CompatibleTracingIntegration(options, version) {
366
354
  "falling back to:",
367
355
  defaultMaxWait
368
356
  );
369
- _lazyRouteTimeout = defaultMaxWait;
357
+ resolvedLazyRouteTimeout = defaultMaxWait;
370
358
  } else {
371
- _lazyRouteTimeout = configuredMaxWait;
359
+ resolvedLazyRouteTimeout = configuredMaxWait;
360
+ }
361
+ if (typeof useLocation === "function" && typeof useNavigationType === "function" && typeof createRoutesFromChildren === "function" && typeof matchRoutes === "function") {
362
+ reactRouterConfigByClient.set(client, {
363
+ useLocation,
364
+ useNavigationType,
365
+ createRoutesFromChildren,
366
+ matchRoutes,
367
+ stripBasename: stripBasename || false,
368
+ enableAsyncRouteHandlers,
369
+ instrumentNavigation,
370
+ lazyRouteTimeout: resolvedLazyRouteTimeout,
371
+ lazyRouteManifest,
372
+ basename: ""
373
+ });
374
+ } else {
375
+ debugBuild.DEBUG_BUILD && core.debug.warn(
376
+ "[React Router] Skipping route instrumentation because `useLocation`, `useNavigationType`, `createRoutesFromChildren` or `matchRoutes` was not provided. Pass them to `reactRouterBrowserTracingIntegration`, or import it from `@sentry/react/react-router` to have them supplied automatically."
377
+ );
372
378
  }
373
- _useEffect = useEffect;
374
- _useLocation = useLocation;
375
- _useNavigationType = useNavigationType;
376
- _matchRoutes = matchRoutes;
377
- _createRoutesFromChildren = createRoutesFromChildren;
378
- _enableAsyncRouteHandlers = enableAsyncRouteHandlers;
379
- _lazyRouteManifest = lazyRouteManifest;
380
- utils.initializeRouterUtils(matchRoutes, stripBasename || false);
381
379
  },
382
380
  afterAllSetup(client) {
383
- integration.afterAllSetup(client);
384
381
  const initPathName = browser.WINDOW.location?.pathname;
385
382
  if (instrumentPageLoad && initPathName) {
386
383
  browser.startBrowserTracingPageLoadSpan(client, {
387
- name: initPathName,
384
+ // With span streaming, span names have to be low cardinality. The route is only resolved
385
+ // once the router renders, which updates the span name then.
386
+ name: core.hasSpanStreamingEnabled(client) ? core.PAGELOAD_SPAN_NAME_FALLBACK : initPathName,
388
387
  attributes: {
389
- [core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "url",
390
- [core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: "pageload",
388
+ [attributes.SENTRY_SEGMENT_NAME_SOURCE]: "url",
389
+ [attributes.SENTRY_OP]: op.PAGELOAD,
391
390
  [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.pageload.react.reactrouter${version ? `_v${version}` : ""}`
392
391
  }
393
392
  });
394
393
  }
395
- if (instrumentNavigation) {
396
- CLIENTS_WITH_INSTRUMENT_NAVIGATION.add(client);
397
- }
398
394
  }
399
- };
395
+ });
400
396
  }
401
397
  function createV6CompatibleWrapUseRoutes(origUseRoutes, version) {
402
- if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes) {
403
- debugBuild.DEBUG_BUILD && core.debug.warn(
404
- "reactRouterV6Instrumentation was unable to wrap `useRoutes` because of one or more missing parameters."
405
- );
406
- return origUseRoutes;
407
- }
408
- const SentryRoutes = (props) => {
398
+ const RouteReporter = ({ config, routes, locationArg }) => {
409
399
  const isMountRenderPass = React.useRef(true);
410
- const { routes, locationArg } = props;
411
- const Routes = origUseRoutes(routes, locationArg);
412
- const location = _useLocation();
413
- const navigationType = _useNavigationType();
400
+ const location = config.useLocation();
401
+ const navigationType = config.useNavigationType();
414
402
  const stableLocationParam = typeof locationArg === "string" || locationArg?.pathname ? locationArg : location;
415
403
  useIsomorphicLayoutEffect(() => {
416
404
  const added = addRoutesToAllRoutes(routes);
@@ -423,7 +411,8 @@ function createV6CompatibleWrapUseRoutes(origUseRoutes, version) {
423
411
  activeRootSpan: utils.getActiveRootSpan(),
424
412
  location: normalizedLocation,
425
413
  routes,
426
- allRoutes: Array.from(allRoutes)
414
+ allRoutes: Array.from(allRoutes),
415
+ config
427
416
  });
428
417
  isMountRenderPass.current = false;
429
418
  } else {
@@ -432,17 +421,26 @@ function createV6CompatibleWrapUseRoutes(origUseRoutes, version) {
432
421
  routes,
433
422
  navigationType,
434
423
  version,
435
- allRoutes: Array.from(allRoutes)
424
+ allRoutes: Array.from(allRoutes),
425
+ config
436
426
  });
437
427
  }
438
428
  }, [navigationType, stableLocationParam]);
439
- return Routes;
429
+ return null;
430
+ };
431
+ const SentryRoutesWrapper = ({
432
+ routes,
433
+ locationArg
434
+ }) => {
435
+ const config = getRouterConfig(core.getClient());
436
+ const routesElement = origUseRoutes(routes, locationArg);
437
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, routesElement, config ? /* @__PURE__ */ React.createElement(RouteReporter, { config, routes, locationArg }) : null);
440
438
  };
441
439
  return (routes, locationArg) => {
442
- return /* @__PURE__ */ React.createElement(SentryRoutes, { routes, locationArg });
440
+ return /* @__PURE__ */ React.createElement(SentryRoutesWrapper, { routes, locationArg });
443
441
  };
444
442
  }
445
- function wrapPatchRoutesOnNavigation(opts, isMemoryRouter = false, capturedSpan) {
443
+ function wrapPatchRoutesOnNavigation(opts, isMemoryRouter, capturedSpan, config) {
446
444
  if (!opts || !("patchRoutesOnNavigation" in opts) || typeof opts.patchRoutesOnNavigation !== "function") {
447
445
  return opts || {};
448
446
  }
@@ -474,14 +472,14 @@ function wrapPatchRoutesOnNavigation(opts, isMemoryRouter = false, capturedSpan)
474
472
  }
475
473
  }
476
474
  const spanJson = activeRootSpan ? core.spanToJSON(activeRootSpan) : void 0;
477
- if (targetPath && activeRootSpan && spanJson && !spanJson.timestamp && // Span hasn't ended yet
478
- spanJson.op === "navigation") {
475
+ if (targetPath && activeRootSpan && spanJson && !spanJson.end_timestamp && // Span hasn't ended yet
476
+ spanJson.attributes[attributes.SENTRY_OP] === "navigation") {
479
477
  updateNavigationSpan(
480
478
  activeRootSpan,
481
479
  { pathname: targetPath, search: "", hash: "", state: null, key: "default" },
482
480
  Array.from(allRoutes),
483
481
  true,
484
- _matchRoutes
482
+ config
485
483
  );
486
484
  }
487
485
  return originalPatch(routeId, children);
@@ -500,8 +498,8 @@ function wrapPatchRoutesOnNavigation(opts, isMemoryRouter = false, capturedSpan)
500
498
  }
501
499
  }
502
500
  const spanJson = activeRootSpan ? core.spanToJSON(activeRootSpan) : void 0;
503
- if (activeRootSpan && spanJson && !spanJson.timestamp && // Span hasn't ended yet
504
- spanJson.op === "navigation") {
501
+ if (activeRootSpan && spanJson && !spanJson.end_timestamp && // Span hasn't ended yet
502
+ spanJson.attributes[attributes.SENTRY_OP] === "navigation") {
505
503
  const pathname = targetPath;
506
504
  if (pathname) {
507
505
  updateNavigationSpan(
@@ -509,7 +507,7 @@ function wrapPatchRoutesOnNavigation(opts, isMemoryRouter = false, capturedSpan)
509
507
  { pathname, search: "", hash: "", state: null, key: "default" },
510
508
  Array.from(allRoutes),
511
509
  false,
512
- _matchRoutes
510
+ config
513
511
  );
514
512
  }
515
513
  }
@@ -523,14 +521,14 @@ function wrapPatchRoutesOnNavigation(opts, isMemoryRouter = false, capturedSpan)
523
521
  };
524
522
  }
525
523
  function handleNavigation(opts) {
526
- const { location, routes, navigationType, version, matches, basename, allRoutes: allRoutes2 } = opts;
527
- const branches = Array.isArray(matches) ? matches : _matchRoutes(allRoutes2 || routes, location, basename);
524
+ const { location, routes, navigationType, version, config, matches, allRoutes: allRoutes2 } = opts;
525
+ const branches = Array.isArray(matches) ? matches : config.matchRoutes(allRoutes2 || routes, location, config.basename);
528
526
  const client = core.getClient();
529
- if (!client || !CLIENTS_WITH_INSTRUMENT_NAVIGATION.has(client)) {
527
+ if (!client || !config.instrumentNavigation) {
530
528
  return;
531
529
  }
532
530
  const activeRootSpan = utils.getActiveRootSpan();
533
- if (activeRootSpan && core.spanToJSON(activeRootSpan).op === "pageload" && navigationType === "POP") {
531
+ if (activeRootSpan && core.spanToJSON(activeRootSpan).attributes[attributes.SENTRY_OP] === "pageload" && navigationType === "POP") {
534
532
  return;
535
533
  }
536
534
  if ((navigationType === "PUSH" || navigationType === "POP") && branches) {
@@ -539,13 +537,11 @@ function handleNavigation(opts) {
539
537
  allRoutes2 || routes,
540
538
  allRoutes2 || routes,
541
539
  branches,
542
- basename,
543
- _lazyRouteManifest,
544
- _enableAsyncRouteHandlers
540
+ config
545
541
  );
546
542
  const locationKey = computeLocationKey(location);
547
543
  const trackedNav = activeNavigationSpans.get(client);
548
- const trackedSpanHasEnded = trackedNav && !trackedNav.isPlaceholder ? !!core.spanToJSON(trackedNav.span).timestamp : false;
544
+ const trackedSpanHasEnded = trackedNav && !trackedNav.isPlaceholder ? !!core.spanToJSON(trackedNav.span).end_timestamp : false;
549
545
  const { skip, shouldUpdate } = shouldSkipNavigation(trackedNav, locationKey, name, trackedSpanHasEnded);
550
546
  if (skip) {
551
547
  if (shouldUpdate && trackedNav) {
@@ -556,16 +552,13 @@ function handleNavigation(opts) {
556
552
  `[Tracing] Updated placeholder navigation name from "${oldName}" to "${name}" (will apply to real span)`
557
553
  );
558
554
  } else {
559
- trackedNav.span.updateName(name);
560
- trackedNav.span.setAttribute(core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);
555
+ const isUnparameterizedStreamedNavigation = source !== "route" && core.hasSpanStreamingEnabled(client);
556
+ trackedNav.span.updateName(isUnparameterizedStreamedNavigation ? core.NAVIGATION_SPAN_NAME_FALLBACK : name);
557
+ trackedNav.span.setAttribute(attributes.SENTRY_SEGMENT_NAME_SOURCE, source);
561
558
  if (source === "route") {
562
559
  trackedNav.span.setAttribute(attributes.URL_TEMPLATE, name);
563
560
  }
564
- core.addNonEnumerableProperty(
565
- trackedNav.span,
566
- "__sentry_navigation_name_set__",
567
- true
568
- );
561
+ core.addNonEnumerableProperty(trackedNav.span, "__sentry_navigation_name_set__", true);
569
562
  trackedNav.routeName = name;
570
563
  debugBuild.DEBUG_BUILD && core.debug.log(`[Tracing] Updated navigation span name from "${oldName}" to "${name}"`);
571
564
  }
@@ -587,11 +580,12 @@ function handleNavigation(opts) {
587
580
  let navigationSpan;
588
581
  try {
589
582
  navigationSpan = browser.startBrowserTracingNavigationSpan(client, {
590
- name: placeholderEntry.routeName,
591
- // Use placeholder's routeName in case it was updated
583
+ // Use placeholder's routeName in case it was updated. With span streaming, span names have to
584
+ // be low cardinality, so we can't fall back to the URL.
585
+ name: source === "route" || !core.hasSpanStreamingEnabled(client) ? placeholderEntry.routeName : core.NAVIGATION_SPAN_NAME_FALLBACK,
592
586
  attributes: {
593
- [core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,
594
- [core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: "navigation",
587
+ [attributes.SENTRY_SEGMENT_NAME_SOURCE]: source,
588
+ [attributes.SENTRY_OP]: op.NAVIGATION,
595
589
  [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.navigation.react.reactrouter${version ? `_v${version}` : ""}`,
596
590
  ...source === "route" && { [attributes.URL_TEMPLATE]: placeholderEntry.routeName }
597
591
  }
@@ -601,6 +595,7 @@ function handleNavigation(opts) {
601
595
  throw e;
602
596
  }
603
597
  if (navigationSpan) {
598
+ core.addNonEnumerableProperty(navigationSpan, "__sentry_navigation_pathname__", location.pathname);
604
599
  activeNavigationSpans.set(client, {
605
600
  span: navigationSpan,
606
601
  routeName: placeholderEntry.routeName,
@@ -608,7 +603,7 @@ function handleNavigation(opts) {
608
603
  pathname: location.pathname,
609
604
  locationKey
610
605
  });
611
- patchSpanEnd(navigationSpan, location, routes, basename, "navigation");
606
+ patchSpanEnd(navigationSpan, location, routes, "navigation", config);
612
607
  } else {
613
608
  activeNavigationSpans.delete(client);
614
609
  }
@@ -648,32 +643,32 @@ function updatePageloadTransaction({
648
643
  activeRootSpan,
649
644
  location,
650
645
  routes,
646
+ config,
651
647
  matches,
652
- basename,
653
648
  allRoutes: allRoutes2
654
649
  }) {
655
- const branches = Array.isArray(matches) ? matches : _matchRoutes(allRoutes2 || routes, location, basename);
650
+ const branches = Array.isArray(matches) ? matches : config.matchRoutes(allRoutes2 || routes, location, config.basename);
656
651
  if (branches) {
657
652
  const [name, source] = utils.resolveRouteNameAndSource(
658
653
  location,
659
654
  allRoutes2 || routes,
660
655
  allRoutes2 || routes,
661
656
  branches,
662
- basename,
663
- _lazyRouteManifest,
664
- _enableAsyncRouteHandlers
657
+ config
665
658
  );
666
659
  core.getCurrentScope().setTransactionName(name || "/");
667
660
  if (activeRootSpan) {
668
- activeRootSpan.updateName(name);
669
- activeRootSpan.setAttribute(core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);
661
+ const client = core.getClient();
662
+ const isUnparameterizedStreamedPageload = source !== "route" && !!client && core.hasSpanStreamingEnabled(client);
663
+ activeRootSpan.updateName(isUnparameterizedStreamedPageload ? core.PAGELOAD_SPAN_NAME_FALLBACK : name);
664
+ activeRootSpan.setAttribute(attributes.SENTRY_SEGMENT_NAME_SOURCE, source);
670
665
  if (source === "route") {
671
666
  activeRootSpan.setAttribute(attributes.URL_TEMPLATE, name);
672
667
  }
673
- patchSpanEnd(activeRootSpan, location, routes, basename, "pageload");
668
+ patchSpanEnd(activeRootSpan, location, routes, "pageload", config);
674
669
  }
675
670
  } else if (activeRootSpan) {
676
- patchSpanEnd(activeRootSpan, location, routes, basename, "pageload");
671
+ patchSpanEnd(activeRootSpan, location, routes, "pageload", config);
677
672
  }
678
673
  }
679
674
  function shouldUpdateWildcardSpanName(currentName, currentSource, newName, newSource, allowNoCurrentName = false) {
@@ -692,32 +687,27 @@ function shouldUpdateWildcardSpanName(currentName, currentSource, newName, newSo
692
687
  }
693
688
  return false;
694
689
  }
695
- function tryUpdateSpanNameBeforeEnd(span, spanJson, currentName, location, routes, basename, spanType, allRoutes2) {
690
+ function tryUpdateSpanNameBeforeEnd(span, spanJson, currentName, location, routes, spanType, allRoutes2, config) {
696
691
  try {
697
- const currentSource = spanJson.data?.[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];
692
+ const currentSource = spanJson.attributes[attributes.SENTRY_SEGMENT_NAME_SOURCE];
698
693
  if (currentSource === "route" && currentName && !utils.transactionNameHasWildcard(currentName)) {
699
694
  return;
700
695
  }
701
696
  const currentAllRoutes = Array.from(allRoutes2);
702
697
  const routesToUse = currentAllRoutes.length > 0 ? currentAllRoutes : routes;
703
- const branches = _matchRoutes(routesToUse, location, basename);
698
+ const branches = config.matchRoutes(routesToUse, location, config.basename);
704
699
  if (!branches) {
705
700
  return;
706
701
  }
707
- const [name, source] = utils.resolveRouteNameAndSource(
708
- location,
709
- routesToUse,
710
- routesToUse,
711
- branches,
712
- basename,
713
- _lazyRouteManifest,
714
- _enableAsyncRouteHandlers
715
- );
702
+ const [name, source] = utils.resolveRouteNameAndSource(location, routesToUse, routesToUse, branches, config);
716
703
  const isImprovement = shouldUpdateWildcardSpanName(currentName, currentSource, name, source, true);
717
- const spanNotEnded = spanType === "pageload" || !spanJson.timestamp;
704
+ const spanNotEnded = spanType === "pageload" || !spanJson.end_timestamp;
718
705
  if (isImprovement && spanNotEnded) {
719
- span.updateName(name);
720
- span.setAttribute(core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);
706
+ const client = core.getClient();
707
+ const isUnparameterizedStreamedSpan = source !== "route" && !!client && core.hasSpanStreamingEnabled(client);
708
+ const fallbackName = spanType === "pageload" ? core.PAGELOAD_SPAN_NAME_FALLBACK : core.NAVIGATION_SPAN_NAME_FALLBACK;
709
+ span.updateName(isUnparameterizedStreamedSpan ? fallbackName : name);
710
+ span.setAttribute(attributes.SENTRY_SEGMENT_NAME_SOURCE, source);
721
711
  if (source === "route") {
722
712
  span.setAttribute(attributes.URL_TEMPLATE, name);
723
713
  }
@@ -726,7 +716,7 @@ function tryUpdateSpanNameBeforeEnd(span, spanJson, currentName, location, route
726
716
  debugBuild.DEBUG_BUILD && core.debug.warn(`Error updating span details before ending: ${error}`);
727
717
  }
728
718
  }
729
- function patchSpanEnd(span, location, routes, basename, spanType) {
719
+ function patchSpanEnd(span, location, routes, spanType, config) {
730
720
  const patchedPropertyName = `__sentry_${spanType}_end_patched__`;
731
721
  const hasEndBeenPatched = span?.[patchedPropertyName];
732
722
  if (hasEndBeenPatched || !span.end) {
@@ -741,13 +731,13 @@ function patchSpanEnd(span, location, routes, basename, spanType) {
741
731
  endCalled = true;
742
732
  const endTimestamp = args.length > 0 ? args[0] : Date.now() / 1e3;
743
733
  const spanJson = core.spanToJSON(span);
744
- const currentName = spanJson.description;
745
- const currentSource = spanJson.data?.[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];
734
+ const currentName = spanJson.name;
735
+ const currentSource = spanJson.attributes[attributes.SENTRY_SEGMENT_NAME_SOURCE];
746
736
  const cleanupNavigationSpan = () => {
747
737
  const client = core.getClient();
748
738
  if (client && spanType === "navigation") {
749
739
  const trackedNav = activeNavigationSpans.get(client);
750
- if (trackedNav && trackedNav.span === span) {
740
+ if (trackedNav?.span === span) {
751
741
  activeNavigationSpans.delete(client);
752
742
  }
753
743
  }
@@ -757,18 +747,18 @@ function patchSpanEnd(span, location, routes, basename, spanType) {
757
747
  const hasPendingOrMayHaveLazyRoutes = pendingPromises && pendingPromises.size > 0 || mayHaveLazyRoutes;
758
748
  const shouldWaitForLazyRoutes = hasPendingOrMayHaveLazyRoutes && currentName && (utils.transactionNameHasWildcard(currentName) || currentSource !== "route");
759
749
  if (shouldWaitForLazyRoutes) {
760
- if (_lazyRouteTimeout === 0) {
761
- tryUpdateSpanNameBeforeEnd(span, spanJson, currentName, location, routes, basename, spanType, allRoutes);
750
+ if (config.lazyRouteTimeout === 0) {
751
+ tryUpdateSpanNameBeforeEnd(span, spanJson, currentName, location, routes, spanType, allRoutes, config);
762
752
  cleanupNavigationSpan();
763
753
  originalEnd(endTimestamp);
764
754
  return;
765
755
  }
766
- const timeoutPromise = new Promise((r) => setTimeout(r, _lazyRouteTimeout));
756
+ const timeoutPromise = new Promise((r) => setTimeout(r, config.lazyRouteTimeout));
767
757
  let waitPromise;
768
758
  if (pendingPromises && pendingPromises.size > 0) {
769
759
  const allSettled = Promise.allSettled(pendingPromises).then(() => {
770
760
  });
771
- waitPromise = _lazyRouteTimeout === Infinity ? allSettled : Promise.race([allSettled, timeoutPromise]);
761
+ waitPromise = config.lazyRouteTimeout === Infinity ? allSettled : Promise.race([allSettled, timeoutPromise]);
772
762
  } else {
773
763
  waitPromise = timeoutPromise;
774
764
  }
@@ -777,12 +767,12 @@ function patchSpanEnd(span, location, routes, basename, spanType) {
777
767
  tryUpdateSpanNameBeforeEnd(
778
768
  span,
779
769
  updatedSpanJson,
780
- updatedSpanJson.description,
770
+ updatedSpanJson.name,
781
771
  location,
782
772
  routes,
783
- basename,
784
773
  spanType,
785
- allRoutes
774
+ allRoutes,
775
+ config
786
776
  );
787
777
  cleanupNavigationSpan();
788
778
  originalEnd(endTimestamp);
@@ -792,24 +782,23 @@ function patchSpanEnd(span, location, routes, basename, spanType) {
792
782
  });
793
783
  return;
794
784
  }
795
- tryUpdateSpanNameBeforeEnd(span, spanJson, currentName, location, routes, basename, spanType, allRoutes);
785
+ tryUpdateSpanNameBeforeEnd(span, spanJson, currentName, location, routes, spanType, allRoutes, config);
796
786
  cleanupNavigationSpan();
797
787
  originalEnd(endTimestamp);
798
788
  };
799
789
  core.addNonEnumerableProperty(span, patchedPropertyName, true);
800
790
  }
801
791
  function createV6CompatibleWithSentryReactRouterRouting(Routes, version) {
802
- if (!_useEffect || !_useLocation || !_useNavigationType || !_createRoutesFromChildren || !_matchRoutes) {
803
- debugBuild.DEBUG_BUILD && core.debug.warn(`reactRouterV6Instrumentation was unable to wrap Routes because of one or more missing parameters.
804
- useEffect: ${_useEffect}. useLocation: ${_useLocation}. useNavigationType: ${_useNavigationType}.
805
- createRoutesFromChildren: ${_createRoutesFromChildren}. matchRoutes: ${_matchRoutes}.`);
806
- return Routes;
807
- }
808
- const SentryRoutes = (props) => {
792
+ const RouteReporter = ({
793
+ config,
794
+ routeChildren
795
+ }) => {
809
796
  const isMountRenderPass = React.useRef(true);
810
- const location = _useLocation();
811
- const navigationType = _useNavigationType();
812
- const routes = _createRoutesFromChildren(props.children);
797
+ const location = config.useLocation();
798
+ const navigationType = config.useNavigationType();
799
+ const routes = config.createRoutesFromChildren(
800
+ routeChildren
801
+ );
813
802
  useIsomorphicLayoutEffect(() => {
814
803
  const added = addRoutesToAllRoutes(routes);
815
804
  return () => removeRoutesFromAllRoutes(added);
@@ -821,17 +810,36 @@ function createV6CompatibleWithSentryReactRouterRouting(Routes, version) {
821
810
  activeRootSpan: utils.getActiveRootSpan(),
822
811
  location,
823
812
  routes,
824
- allRoutes: Array.from(allRoutes)
813
+ allRoutes: Array.from(allRoutes),
814
+ config
825
815
  });
826
816
  isMountRenderPass.current = false;
827
817
  } else {
828
- handleNavigation({ location, routes, navigationType, version, allRoutes: Array.from(allRoutes) });
818
+ handleNavigation({
819
+ location,
820
+ routes,
821
+ navigationType,
822
+ version,
823
+ allRoutes: Array.from(allRoutes),
824
+ config
825
+ });
829
826
  }
830
827
  },
831
828
  // Re-run only on location/navigation changes, not children changes
832
829
  [location, navigationType]
833
830
  );
834
- return /* @__PURE__ */ React.createElement(Routes, { ...props });
831
+ return null;
832
+ };
833
+ const SentryRoutes = (props) => {
834
+ const config = getRouterConfig(core.getClient());
835
+ return /* @__PURE__ */ React.createElement(
836
+ React.Fragment,
837
+ null,
838
+ // @ts-expect-error Setting more specific React Component typing for `R` generic above
839
+ // will break advanced type inference done by react router params
840
+ /* @__PURE__ */ React.createElement(Routes, { ...props }),
841
+ config ? /* @__PURE__ */ React.createElement(RouteReporter, { config, routeChildren: props.children }) : null
842
+ );
835
843
  };
836
844
  hoistNonReactStatics.hoistNonReactStatics(SentryRoutes, Routes);
837
845
  return SentryRoutes;