react-router 7.9.5-pre.0 → 7.9.6-pre.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 (64) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/dist/development/{browser-DM83uryY.d.ts → browser-BbBXFHbO.d.ts} +1 -1
  3. package/dist/development/{browser-DfMfSvsC.d.mts → browser-C07r42Tt.d.mts} +1 -1
  4. package/dist/development/{chunk-76L3QNAV.mjs → chunk-7TW6LJC6.mjs} +71 -20
  5. package/dist/development/{chunk-KXZSW2DO.js → chunk-DB25NZIA.js} +7 -7
  6. package/dist/development/{chunk-FXLUBU25.js → chunk-IR7LYQCC.js} +93 -93
  7. package/dist/{production/chunk-4JX2RDWY.mjs → development/chunk-P6ZEAD4C.mjs} +2 -2
  8. package/dist/development/{chunk-TSYPWE43.js → chunk-TUTX3ERH.js} +100 -49
  9. package/dist/development/dom-export.d.mts +2 -2
  10. package/dist/development/dom-export.d.ts +2 -2
  11. package/dist/development/dom-export.js +26 -26
  12. package/dist/development/dom-export.mjs +3 -3
  13. package/dist/development/{index-react-server-client-BSxMvS7Z.d.ts → index-react-server-client-Da3kmxNd.d.ts} +1 -1
  14. package/dist/development/{index-react-server-client-B0vnxMMk.d.mts → index-react-server-client-rcoGPJhU.d.mts} +1 -1
  15. package/dist/development/index-react-server-client.d.mts +2 -2
  16. package/dist/development/index-react-server-client.d.ts +2 -2
  17. package/dist/development/index-react-server-client.js +4 -4
  18. package/dist/development/index-react-server-client.mjs +2 -2
  19. package/dist/development/index-react-server.js +1 -1
  20. package/dist/development/index-react-server.mjs +1 -1
  21. package/dist/development/index.d.mts +8 -8
  22. package/dist/development/index.d.ts +8 -8
  23. package/dist/development/index.js +76 -76
  24. package/dist/development/index.mjs +3 -3
  25. package/dist/{production/instrumentation-iAqbU5Q4.d.ts → development/instrumentation-Unc20tLk.d.ts} +5 -1
  26. package/dist/development/lib/types/internal.d.mts +2 -2
  27. package/dist/development/lib/types/internal.d.ts +2 -2
  28. package/dist/development/lib/types/internal.js +1 -1
  29. package/dist/development/lib/types/internal.mjs +1 -1
  30. package/dist/development/{register-c-dooqKE.d.ts → register-BpU9rFBJ.d.ts} +1 -1
  31. package/dist/development/{register-_G476ptB.d.mts → register-QkB3HGjm.d.mts} +1 -1
  32. package/dist/{production/router-DIAPGK5f.d.mts → development/router-CAvh_Drx.d.mts} +5 -1
  33. package/dist/production/{browser-DM83uryY.d.ts → browser-BbBXFHbO.d.ts} +1 -1
  34. package/dist/production/{browser-DfMfSvsC.d.mts → browser-C07r42Tt.d.mts} +1 -1
  35. package/dist/{development/chunk-B6QYCHJF.mjs → production/chunk-4MBU4DF6.mjs} +2 -2
  36. package/dist/production/{chunk-7EXEUENX.mjs → chunk-GG2LAVOQ.mjs} +71 -20
  37. package/dist/production/{chunk-4SZHQXEM.js → chunk-MKF3AQDO.js} +7 -7
  38. package/dist/production/{chunk-ARKB3I5K.js → chunk-RBZEEJIK.js} +100 -49
  39. package/dist/production/{chunk-OB3KSCCZ.js → chunk-ZHTTD7UY.js} +93 -93
  40. package/dist/production/dom-export.d.mts +2 -2
  41. package/dist/production/dom-export.d.ts +2 -2
  42. package/dist/production/dom-export.js +26 -26
  43. package/dist/production/dom-export.mjs +3 -3
  44. package/dist/production/{index-react-server-client-BSxMvS7Z.d.ts → index-react-server-client-Da3kmxNd.d.ts} +1 -1
  45. package/dist/production/{index-react-server-client-B0vnxMMk.d.mts → index-react-server-client-rcoGPJhU.d.mts} +1 -1
  46. package/dist/production/index-react-server-client.d.mts +2 -2
  47. package/dist/production/index-react-server-client.d.ts +2 -2
  48. package/dist/production/index-react-server-client.js +4 -4
  49. package/dist/production/index-react-server-client.mjs +2 -2
  50. package/dist/production/index-react-server.js +1 -1
  51. package/dist/production/index-react-server.mjs +1 -1
  52. package/dist/production/index.d.mts +8 -8
  53. package/dist/production/index.d.ts +8 -8
  54. package/dist/production/index.js +76 -76
  55. package/dist/production/index.mjs +3 -3
  56. package/dist/{development/instrumentation-iAqbU5Q4.d.ts → production/instrumentation-Unc20tLk.d.ts} +5 -1
  57. package/dist/production/lib/types/internal.d.mts +2 -2
  58. package/dist/production/lib/types/internal.d.ts +2 -2
  59. package/dist/production/lib/types/internal.js +1 -1
  60. package/dist/production/lib/types/internal.mjs +1 -1
  61. package/dist/production/{register-c-dooqKE.d.ts → register-BpU9rFBJ.d.ts} +1 -1
  62. package/dist/production/{register-_G476ptB.d.mts → register-QkB3HGjm.d.mts} +1 -1
  63. package/dist/{development/router-DIAPGK5f.d.mts → production/router-CAvh_Drx.d.mts} +5 -1
  64. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { R as RouteModule } from './instrumentation-iAqbU5Q4.js';
1
+ import { R as RouteModule } from './instrumentation-Unc20tLk.js';
2
2
 
3
3
  /**
4
4
  * Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
@@ -1,4 +1,4 @@
1
- import { R as RouteModule } from './router-DIAPGK5f.mjs';
1
+ import { R as RouteModule } from './router-CAvh_Drx.mjs';
2
2
 
3
3
  /**
4
4
  * Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
@@ -1178,7 +1178,11 @@ declare function createMemoryRouter(routes: RouteObject[], opts?: MemoryRouterOp
1178
1178
  * and rendering errors via `componentDidCatch`
1179
1179
  */
1180
1180
  interface unstable_ClientOnErrorFunction {
1181
- (error: unknown, errorInfo?: React.ErrorInfo): void;
1181
+ (error: unknown, info: {
1182
+ location: Location;
1183
+ params: Params;
1184
+ errorInfo?: React.ErrorInfo;
1185
+ }): void;
1182
1186
  }
1183
1187
  /**
1184
1188
  * @category Types
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction, e as RouterInit } from './instrumentation-iAqbU5Q4.js';
2
+ import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction, e as RouterInit } from './instrumentation-Unc20tLk.js';
3
3
 
4
4
  type RSCRouteConfigEntryBase = {
5
5
  action?: ActionFunction;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction, e as RouterInit } from './router-DIAPGK5f.mjs';
2
+ import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction, e as RouterInit } from './router-CAvh_Drx.mjs';
3
3
 
4
4
  type RSCRouteConfigEntryBase = {
5
5
  action?: ActionFunction;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.9.5-pre.0
2
+ * react-router v7.9.6-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -49,7 +49,7 @@ import {
49
49
  withComponentProps,
50
50
  withErrorBoundaryProps,
51
51
  withHydrateFallbackProps
52
- } from "./chunk-76L3QNAV.mjs";
52
+ } from "./chunk-GG2LAVOQ.mjs";
53
53
 
54
54
  // lib/dom/ssr/server.tsx
55
55
  import * as React from "react";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.9.5-pre.0
2
+ * react-router v7.9.6-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -2306,6 +2306,14 @@ function createRouter(init) {
2306
2306
  key
2307
2307
  );
2308
2308
  let actionResult = actionResults[match.route.id];
2309
+ if (!actionResult) {
2310
+ for (let match2 of fetchMatches) {
2311
+ if (actionResults[match2.route.id]) {
2312
+ actionResult = actionResults[match2.route.id];
2313
+ break;
2314
+ }
2315
+ }
2316
+ }
2309
2317
  if (fetchRequest.signal.aborted) {
2310
2318
  if (fetchControllers.get(key) === abortController) {
2311
2319
  fetchControllers.delete(key);
@@ -2962,23 +2970,43 @@ function createRouter(init) {
2962
2970
  return { type: "aborted" };
2963
2971
  }
2964
2972
  let newMatches = matchRoutes(routesToUse, pathname, basename);
2973
+ let newPartialMatches = null;
2965
2974
  if (newMatches) {
2966
- return { type: "success", matches: newMatches };
2975
+ if (Object.keys(newMatches[0].params).length === 0) {
2976
+ return { type: "success", matches: newMatches };
2977
+ } else {
2978
+ newPartialMatches = matchRoutesImpl(
2979
+ routesToUse,
2980
+ pathname,
2981
+ basename,
2982
+ true
2983
+ );
2984
+ let matchedDeeper = newPartialMatches && partialMatches.length < newPartialMatches.length && compareMatches(
2985
+ partialMatches,
2986
+ newPartialMatches.slice(0, partialMatches.length)
2987
+ );
2988
+ if (!matchedDeeper) {
2989
+ return { type: "success", matches: newMatches };
2990
+ }
2991
+ }
2967
2992
  }
2968
- let newPartialMatches = matchRoutesImpl(
2969
- routesToUse,
2970
- pathname,
2971
- basename,
2972
- true
2973
- );
2974
- if (!newPartialMatches || partialMatches.length === newPartialMatches.length && partialMatches.every(
2975
- (m, i) => m.route.id === newPartialMatches[i].route.id
2976
- )) {
2993
+ if (!newPartialMatches) {
2994
+ newPartialMatches = matchRoutesImpl(
2995
+ routesToUse,
2996
+ pathname,
2997
+ basename,
2998
+ true
2999
+ );
3000
+ }
3001
+ if (!newPartialMatches || compareMatches(partialMatches, newPartialMatches)) {
2977
3002
  return { type: "success", matches: null };
2978
3003
  }
2979
3004
  partialMatches = newPartialMatches;
2980
3005
  }
2981
3006
  }
3007
+ function compareMatches(a, b) {
3008
+ return a.length === b.length && a.every((m, i) => m.route.id === b[i].route.id);
3009
+ }
2982
3010
  function _internalSetRoutes(newRoutes) {
2983
3011
  manifest = {};
2984
3012
  inFlightDataRoutes = convertRoutesToDataRoutes(
@@ -5589,8 +5617,8 @@ var RenderErrorBoundary = class extends React2.Component {
5589
5617
  };
5590
5618
  }
5591
5619
  componentDidCatch(error, errorInfo) {
5592
- if (this.props.unstable_onError) {
5593
- this.props.unstable_onError(error, errorInfo);
5620
+ if (this.props.onError) {
5621
+ this.props.onError(error, errorInfo);
5594
5622
  } else {
5595
5623
  console.error(
5596
5624
  "React Router caught the following error during render",
@@ -5668,6 +5696,13 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
5668
5696
  }
5669
5697
  }
5670
5698
  }
5699
+ let onError = dataRouterState && unstable_onError ? (error, errorInfo) => {
5700
+ unstable_onError(error, {
5701
+ location: dataRouterState.location,
5702
+ params: dataRouterState.matches?.[0]?.params ?? {},
5703
+ errorInfo
5704
+ });
5705
+ } : void 0;
5671
5706
  return renderedMatches.reduceRight(
5672
5707
  (outlet, match, index) => {
5673
5708
  let error;
@@ -5728,7 +5763,7 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
5728
5763
  error,
5729
5764
  children: getChildren(),
5730
5765
  routeContext: { outlet: null, matches: matches2, isDataRoute: true },
5731
- unstable_onError
5766
+ onError
5732
5767
  }
5733
5768
  ) : getChildren();
5734
5769
  },
@@ -6140,7 +6175,10 @@ function RouterProvider({
6140
6175
  if (newState.errors && unstable_onError) {
6141
6176
  Object.entries(newState.errors).forEach(([routeId, error]) => {
6142
6177
  if (prevState.errors?.[routeId] !== error) {
6143
- unstable_onError(error);
6178
+ unstable_onError(error, {
6179
+ location: newState.location,
6180
+ params: newState.matches[0]?.params ?? {}
6181
+ });
6144
6182
  }
6145
6183
  });
6146
6184
  }
@@ -6469,12 +6507,25 @@ function Await({
6469
6507
  resolve
6470
6508
  }) {
6471
6509
  let dataRouterContext = React3.useContext(DataRouterContext);
6510
+ let dataRouterStateContext = React3.useContext(DataRouterStateContext);
6511
+ let onError = React3.useCallback(
6512
+ (error, errorInfo) => {
6513
+ if (dataRouterContext && dataRouterContext.unstable_onError && dataRouterStateContext) {
6514
+ dataRouterContext.unstable_onError(error, {
6515
+ location: dataRouterStateContext.location,
6516
+ params: dataRouterStateContext.matches?.[0]?.params || {},
6517
+ errorInfo
6518
+ });
6519
+ }
6520
+ },
6521
+ [dataRouterContext, dataRouterStateContext]
6522
+ );
6472
6523
  return /* @__PURE__ */ React3.createElement(
6473
6524
  AwaitErrorBoundary,
6474
6525
  {
6475
6526
  resolve,
6476
6527
  errorElement,
6477
- unstable_onError: dataRouterContext?.unstable_onError
6528
+ onError
6478
6529
  },
6479
6530
  /* @__PURE__ */ React3.createElement(ResolveAwait, null, children)
6480
6531
  );
@@ -6488,8 +6539,8 @@ var AwaitErrorBoundary = class extends React3.Component {
6488
6539
  return { error };
6489
6540
  }
6490
6541
  componentDidCatch(error, errorInfo) {
6491
- if (this.props.unstable_onError) {
6492
- this.props.unstable_onError(error, errorInfo);
6542
+ if (this.props.onError) {
6543
+ this.props.onError(error, errorInfo);
6493
6544
  } else {
6494
6545
  console.error(
6495
6546
  "<Await> caught the following error during render",
@@ -6523,7 +6574,7 @@ var AwaitErrorBoundary = class extends React3.Component {
6523
6574
  promise = resolve.then(
6524
6575
  (data2) => Object.defineProperty(resolve, "_data", { get: () => data2 }),
6525
6576
  (error) => {
6526
- this.props.unstable_onError?.(error);
6577
+ this.props.onError?.(error);
6527
6578
  Object.defineProperty(resolve, "_error", { get: () => error });
6528
6579
  }
6529
6580
  );
@@ -9466,7 +9517,7 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
9466
9517
  try {
9467
9518
  if (isBrowser) {
9468
9519
  window.__reactRouterVersion = // @ts-expect-error
9469
- "7.9.5-pre.0";
9520
+ "7.9.6-pre.0";
9470
9521
  }
9471
9522
  } catch (e) {
9472
9523
  }
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/**
2
- * react-router v7.9.5-pre.0
2
+ * react-router v7.9.6-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -14,7 +14,7 @@
14
14
 
15
15
 
16
16
 
17
- var _chunkARKB3I5Kjs = require('./chunk-ARKB3I5K.js');
17
+ var _chunkRBZEEJIKjs = require('./chunk-RBZEEJIK.js');
18
18
 
19
19
  // lib/dom/ssr/hydration.tsx
20
20
  function getHydrationData({
@@ -29,12 +29,12 @@ function getHydrationData({
29
29
  ...state,
30
30
  loaderData: { ...state.loaderData }
31
31
  };
32
- let initialMatches = _chunkARKB3I5Kjs.matchRoutes.call(void 0, routes, location, basename);
32
+ let initialMatches = _chunkRBZEEJIKjs.matchRoutes.call(void 0, routes, location, basename);
33
33
  if (initialMatches) {
34
34
  for (let match of initialMatches) {
35
35
  let routeId = match.route.id;
36
36
  let routeInfo = getRouteInfo(routeId);
37
- if (_chunkARKB3I5Kjs.shouldHydrateRouteLoader.call(void 0,
37
+ if (_chunkRBZEEJIKjs.shouldHydrateRouteLoader.call(void 0,
38
38
  routeId,
39
39
  routeInfo.clientLoader,
40
40
  routeInfo.hasLoader,
@@ -112,7 +112,7 @@ function RSCDefaultRootErrorBoundaryImpl({
112
112
  }
113
113
  }
114
114
  );
115
- if (_chunkARKB3I5Kjs.isRouteErrorResponse.call(void 0, error)) {
115
+ if (_chunkRBZEEJIKjs.isRouteErrorResponse.call(void 0, error)) {
116
116
  return /* @__PURE__ */ _react2.default.createElement(
117
117
  ErrorWrapper,
118
118
  {
@@ -120,7 +120,7 @@ function RSCDefaultRootErrorBoundaryImpl({
120
120
  title: "Unhandled Thrown Response!"
121
121
  },
122
122
  /* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText),
123
- _chunkARKB3I5Kjs.ENABLE_DEV_WARNINGS ? heyDeveloper : null
123
+ _chunkRBZEEJIKjs.ENABLE_DEV_WARNINGS ? heyDeveloper : null
124
124
  );
125
125
  }
126
126
  let errorInstance;
@@ -146,7 +146,7 @@ function RSCDefaultRootErrorBoundaryImpl({
146
146
  function RSCDefaultRootErrorBoundary({
147
147
  hasRootLayout
148
148
  }) {
149
- let error = _chunkARKB3I5Kjs.useRouteError.call(void 0, );
149
+ let error = _chunkRBZEEJIKjs.useRouteError.call(void 0, );
150
150
  if (hasRootLayout === void 0) {
151
151
  throw new Error("Missing 'hasRootLayout' prop");
152
152
  }
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
2
- * react-router v7.9.5-pre.0
2
+ * react-router v7.9.6-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -2306,6 +2306,14 @@ function createRouter(init) {
2306
2306
  key
2307
2307
  );
2308
2308
  let actionResult = actionResults[match.route.id];
2309
+ if (!actionResult) {
2310
+ for (let match2 of fetchMatches) {
2311
+ if (actionResults[match2.route.id]) {
2312
+ actionResult = actionResults[match2.route.id];
2313
+ break;
2314
+ }
2315
+ }
2316
+ }
2309
2317
  if (fetchRequest.signal.aborted) {
2310
2318
  if (fetchControllers.get(key) === abortController) {
2311
2319
  fetchControllers.delete(key);
@@ -2962,23 +2970,43 @@ function createRouter(init) {
2962
2970
  return { type: "aborted" };
2963
2971
  }
2964
2972
  let newMatches = matchRoutes(routesToUse, pathname, basename);
2973
+ let newPartialMatches = null;
2965
2974
  if (newMatches) {
2966
- return { type: "success", matches: newMatches };
2975
+ if (Object.keys(newMatches[0].params).length === 0) {
2976
+ return { type: "success", matches: newMatches };
2977
+ } else {
2978
+ newPartialMatches = matchRoutesImpl(
2979
+ routesToUse,
2980
+ pathname,
2981
+ basename,
2982
+ true
2983
+ );
2984
+ let matchedDeeper = newPartialMatches && partialMatches.length < newPartialMatches.length && compareMatches(
2985
+ partialMatches,
2986
+ newPartialMatches.slice(0, partialMatches.length)
2987
+ );
2988
+ if (!matchedDeeper) {
2989
+ return { type: "success", matches: newMatches };
2990
+ }
2991
+ }
2967
2992
  }
2968
- let newPartialMatches = matchRoutesImpl(
2969
- routesToUse,
2970
- pathname,
2971
- basename,
2972
- true
2973
- );
2974
- if (!newPartialMatches || partialMatches.length === newPartialMatches.length && partialMatches.every(
2975
- (m, i) => m.route.id === newPartialMatches[i].route.id
2976
- )) {
2993
+ if (!newPartialMatches) {
2994
+ newPartialMatches = matchRoutesImpl(
2995
+ routesToUse,
2996
+ pathname,
2997
+ basename,
2998
+ true
2999
+ );
3000
+ }
3001
+ if (!newPartialMatches || compareMatches(partialMatches, newPartialMatches)) {
2977
3002
  return { type: "success", matches: null };
2978
3003
  }
2979
3004
  partialMatches = newPartialMatches;
2980
3005
  }
2981
3006
  }
3007
+ function compareMatches(a, b) {
3008
+ return a.length === b.length && a.every((m, i) => m.route.id === b[i].route.id);
3009
+ }
2982
3010
  function _internalSetRoutes(newRoutes) {
2983
3011
  manifest = {};
2984
3012
  inFlightDataRoutes = convertRoutesToDataRoutes(
@@ -6767,8 +6795,8 @@ var RenderErrorBoundary = class extends React3.Component {
6767
6795
  };
6768
6796
  }
6769
6797
  componentDidCatch(error, errorInfo) {
6770
- if (this.props.unstable_onError) {
6771
- this.props.unstable_onError(error, errorInfo);
6798
+ if (this.props.onError) {
6799
+ this.props.onError(error, errorInfo);
6772
6800
  } else {
6773
6801
  console.error(
6774
6802
  "React Router caught the following error during render",
@@ -6846,6 +6874,13 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
6846
6874
  }
6847
6875
  }
6848
6876
  }
6877
+ let onError = dataRouterState && unstable_onError ? (error, errorInfo) => {
6878
+ unstable_onError(error, {
6879
+ location: dataRouterState.location,
6880
+ params: _nullishCoalesce(_optionalChain([dataRouterState, 'access', _76 => _76.matches, 'optionalAccess', _77 => _77[0], 'optionalAccess', _78 => _78.params]), () => ( {})),
6881
+ errorInfo
6882
+ });
6883
+ } : void 0;
6849
6884
  return renderedMatches.reduceRight(
6850
6885
  (outlet, match, index) => {
6851
6886
  let error;
@@ -6906,7 +6941,7 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
6906
6941
  error,
6907
6942
  children: getChildren(),
6908
6943
  routeContext: { outlet: null, matches: matches2, isDataRoute: true },
6909
- unstable_onError
6944
+ onError
6910
6945
  }
6911
6946
  ) : getChildren();
6912
6947
  },
@@ -6988,15 +7023,15 @@ function useRouteError() {
6988
7023
  if (error !== void 0) {
6989
7024
  return error;
6990
7025
  }
6991
- return _optionalChain([state, 'access', _76 => _76.errors, 'optionalAccess', _77 => _77[routeId]]);
7026
+ return _optionalChain([state, 'access', _79 => _79.errors, 'optionalAccess', _80 => _80[routeId]]);
6992
7027
  }
6993
7028
  function useAsyncValue() {
6994
7029
  let value = React3.useContext(AwaitContext);
6995
- return _optionalChain([value, 'optionalAccess', _78 => _78._data]);
7030
+ return _optionalChain([value, 'optionalAccess', _81 => _81._data]);
6996
7031
  }
6997
7032
  function useAsyncError() {
6998
7033
  let value = React3.useContext(AwaitContext);
6999
- return _optionalChain([value, 'optionalAccess', _79 => _79._error]);
7034
+ return _optionalChain([value, 'optionalAccess', _82 => _82._error]);
7000
7035
  }
7001
7036
  var blockerId = 0;
7002
7037
  function useBlocker(shouldBlock) {
@@ -7077,7 +7112,7 @@ function useRoute(...args) {
7077
7112
  return {
7078
7113
  handle: route.route.handle,
7079
7114
  loaderData: state.loaderData[id],
7080
- actionData: _optionalChain([state, 'access', _80 => _80.actionData, 'optionalAccess', _81 => _81[id]])
7115
+ actionData: _optionalChain([state, 'access', _83 => _83.actionData, 'optionalAccess', _84 => _84[id]])
7081
7116
  };
7082
7117
  }
7083
7118
 
@@ -7122,7 +7157,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
7122
7157
  let route = manifest.routes[match.route.id];
7123
7158
  return [
7124
7159
  route && route.css ? route.css.map((href) => ({ rel: "stylesheet", href })) : [],
7125
- _optionalChain([module, 'optionalAccess', _82 => _82.links, 'optionalCall', _83 => _83()]) || []
7160
+ _optionalChain([module, 'optionalAccess', _85 => _85.links, 'optionalCall', _86 => _86()]) || []
7126
7161
  ];
7127
7162
  }).flat(2);
7128
7163
  let preloads = getModuleLinkHrefs(matches, manifest);
@@ -7223,7 +7258,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
7223
7258
  // param change, /users/123 -> /users/456
7224
7259
  currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
7225
7260
  // e.g. /files/images/avatar.jpg -> files/finances.xls
7226
- _optionalChain([currentMatches, 'access', _84 => _84[index], 'access', _85 => _85.route, 'access', _86 => _86.path, 'optionalAccess', _87 => _87.endsWith, 'call', _88 => _88("*")]) && currentMatches[index].params["*"] !== match.params["*"]
7261
+ _optionalChain([currentMatches, 'access', _87 => _87[index], 'access', _88 => _88.route, 'access', _89 => _89.path, 'optionalAccess', _90 => _90.endsWith, 'call', _91 => _91("*")]) && currentMatches[index].params["*"] !== match.params["*"]
7227
7262
  );
7228
7263
  };
7229
7264
  if (mode === "assets") {
@@ -7246,7 +7281,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
7246
7281
  location.pathname + location.search + location.hash,
7247
7282
  window.origin
7248
7283
  ),
7249
- currentParams: _optionalChain([currentMatches, 'access', _89 => _89[0], 'optionalAccess', _90 => _90.params]) || {},
7284
+ currentParams: _optionalChain([currentMatches, 'access', _92 => _92[0], 'optionalAccess', _93 => _93.params]) || {},
7250
7285
  nextUrl: new URL(page, window.origin),
7251
7286
  nextParams: match.params,
7252
7287
  defaultShouldRevalidate: true
@@ -7518,10 +7553,10 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
7518
7553
  )
7519
7554
  });
7520
7555
  let hasInitialData = initialState && initialState.loaderData && route.id in initialState.loaderData;
7521
- let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _91 => _91.loaderData, 'optionalAccess', _92 => _92[route.id]]) : void 0;
7556
+ let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _94 => _94.loaderData, 'optionalAccess', _95 => _95[route.id]]) : void 0;
7522
7557
  let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
7523
- let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _93 => _93.errors, 'optionalAccess', _94 => _94[route.id]]) : void 0;
7524
- let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _95 => _95.clientLoader, 'optionalAccess', _96 => _96.hydrate]) === true || !route.hasLoader);
7558
+ let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _96 => _96.errors, 'optionalAccess', _97 => _97[route.id]]) : void 0;
7559
+ let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _98 => _98.clientLoader, 'optionalAccess', _99 => _99.hydrate]) === true || !route.hasLoader);
7525
7560
  dataRoute.loader = async ({ request, params, context, unstable_pattern }, singleFetch) => {
7526
7561
  try {
7527
7562
  let result = await prefetchStylesAndCallHandler(async () => {
@@ -7817,7 +7852,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
7817
7852
  function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
7818
7853
  React6.useEffect(() => {
7819
7854
  if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
7820
- _optionalChain([window, 'access', _97 => _97.navigator, 'optionalAccess', _98 => _98.connection, 'optionalAccess', _99 => _99.saveData]) === true) {
7855
+ _optionalChain([window, 'access', _100 => _100.navigator, 'optionalAccess', _101 => _101.connection, 'optionalAccess', _102 => _102.saveData]) === true) {
7821
7856
  return;
7822
7857
  }
7823
7858
  function registerElement(el) {
@@ -7926,7 +7961,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
7926
7961
  }
7927
7962
  serverPatches = await res.json();
7928
7963
  } catch (e) {
7929
- if (_optionalChain([signal, 'optionalAccess', _100 => _100.aborted])) return;
7964
+ if (_optionalChain([signal, 'optionalAccess', _103 => _103.aborted])) return;
7930
7965
  throw e;
7931
7966
  }
7932
7967
  let knownRoutes = new Set(Object.keys(manifest.routes));
@@ -8167,7 +8202,7 @@ function PrefetchPageLinksImpl({
8167
8202
  if (!manifestRoute || !manifestRoute.hasLoader) {
8168
8203
  return;
8169
8204
  }
8170
- if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access', _101 => _101[m.route.id], 'optionalAccess', _102 => _102.shouldRevalidate])) {
8205
+ if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access', _104 => _104[m.route.id], 'optionalAccess', _105 => _105.shouldRevalidate])) {
8171
8206
  foundOptOutRoute = true;
8172
8207
  } else if (manifestRoute.hasClientLoader) {
8173
8208
  foundOptOutRoute = true;
@@ -8241,7 +8276,7 @@ function Meta() {
8241
8276
  error
8242
8277
  };
8243
8278
  matches[i] = match;
8244
- if (_optionalChain([routeModule, 'optionalAccess', _103 => _103.meta])) {
8279
+ if (_optionalChain([routeModule, 'optionalAccess', _106 => _106.meta])) {
8245
8280
  routeMeta = typeof routeModule.meta === "function" ? routeModule.meta({
8246
8281
  data: data2,
8247
8282
  loaderData: data2,
@@ -8340,7 +8375,7 @@ function Scripts(scriptProps) {
8340
8375
  }
8341
8376
  let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
8342
8377
  let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
8343
- let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access', _104 => _104.hmr, 'optionalAccess', _105 => _105.runtime]) ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
8378
+ let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access', _107 => _107.hmr, 'optionalAccess', _108 => _108.runtime]) ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
8344
8379
  ${matches.map((match, routeIndex) => {
8345
8380
  let routeVarName = `route${routeIndex}`;
8346
8381
  let manifestEntry = manifest.routes[match.route.id];
@@ -8570,7 +8605,7 @@ function BoundaryShell({
8570
8605
  children
8571
8606
  }) {
8572
8607
  let { routeModules } = useFrameworkContext();
8573
- if (_optionalChain([routeModules, 'access', _106 => _106.root, 'optionalAccess', _107 => _107.Layout]) && !isOutsideRemixApp) {
8608
+ if (_optionalChain([routeModules, 'access', _109 => _109.root, 'optionalAccess', _110 => _110.Layout]) && !isOutsideRemixApp) {
8574
8609
  return children;
8575
8610
  }
8576
8611
  return /* @__PURE__ */ React8.createElement("html", { lang: "en" }, /* @__PURE__ */ React8.createElement("head", null, /* @__PURE__ */ React8.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ React8.createElement(
@@ -8640,20 +8675,20 @@ var hydrationRouteProperties = [
8640
8675
  ];
8641
8676
  function createMemoryRouter(routes, opts) {
8642
8677
  return createRouter({
8643
- basename: _optionalChain([opts, 'optionalAccess', _108 => _108.basename]),
8644
- getContext: _optionalChain([opts, 'optionalAccess', _109 => _109.getContext]),
8645
- future: _optionalChain([opts, 'optionalAccess', _110 => _110.future]),
8678
+ basename: _optionalChain([opts, 'optionalAccess', _111 => _111.basename]),
8679
+ getContext: _optionalChain([opts, 'optionalAccess', _112 => _112.getContext]),
8680
+ future: _optionalChain([opts, 'optionalAccess', _113 => _113.future]),
8646
8681
  history: createMemoryHistory({
8647
- initialEntries: _optionalChain([opts, 'optionalAccess', _111 => _111.initialEntries]),
8648
- initialIndex: _optionalChain([opts, 'optionalAccess', _112 => _112.initialIndex])
8682
+ initialEntries: _optionalChain([opts, 'optionalAccess', _114 => _114.initialEntries]),
8683
+ initialIndex: _optionalChain([opts, 'optionalAccess', _115 => _115.initialIndex])
8649
8684
  }),
8650
- hydrationData: _optionalChain([opts, 'optionalAccess', _113 => _113.hydrationData]),
8685
+ hydrationData: _optionalChain([opts, 'optionalAccess', _116 => _116.hydrationData]),
8651
8686
  routes,
8652
8687
  hydrationRouteProperties,
8653
8688
  mapRouteProperties,
8654
- dataStrategy: _optionalChain([opts, 'optionalAccess', _114 => _114.dataStrategy]),
8655
- patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _115 => _115.patchRoutesOnNavigation]),
8656
- unstable_instrumentations: _optionalChain([opts, 'optionalAccess', _116 => _116.unstable_instrumentations])
8689
+ dataStrategy: _optionalChain([opts, 'optionalAccess', _117 => _117.dataStrategy]),
8690
+ patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _118 => _118.patchRoutesOnNavigation]),
8691
+ unstable_instrumentations: _optionalChain([opts, 'optionalAccess', _119 => _119.unstable_instrumentations])
8657
8692
  }).initialize();
8658
8693
  }
8659
8694
  var Deferred2 = class {
@@ -8715,12 +8750,12 @@ function UNSTABLE_TransitionEnabledRouterProvider({
8715
8750
  go: (n) => router.navigate(n),
8716
8751
  push: (to, state2, opts) => router.navigate(to, {
8717
8752
  state: state2,
8718
- preventScrollReset: _optionalChain([opts, 'optionalAccess', _117 => _117.preventScrollReset])
8753
+ preventScrollReset: _optionalChain([opts, 'optionalAccess', _120 => _120.preventScrollReset])
8719
8754
  }),
8720
8755
  replace: (to, state2, opts) => router.navigate(to, {
8721
8756
  replace: true,
8722
8757
  state: state2,
8723
- preventScrollReset: _optionalChain([opts, 'optionalAccess', _118 => _118.preventScrollReset])
8758
+ preventScrollReset: _optionalChain([opts, 'optionalAccess', _121 => _121.preventScrollReset])
8724
8759
  })
8725
8760
  };
8726
8761
  }, [router]);
@@ -8807,8 +8842,11 @@ function RouterProvider({
8807
8842
  setStateImpl((prevState) => {
8808
8843
  if (newState.errors && unstable_onError) {
8809
8844
  Object.entries(newState.errors).forEach(([routeId, error]) => {
8810
- if (_optionalChain([prevState, 'access', _119 => _119.errors, 'optionalAccess', _120 => _120[routeId]]) !== error) {
8811
- unstable_onError(error);
8845
+ if (_optionalChain([prevState, 'access', _122 => _122.errors, 'optionalAccess', _123 => _123[routeId]]) !== error) {
8846
+ unstable_onError(error, {
8847
+ location: newState.location,
8848
+ params: _nullishCoalesce(_optionalChain([newState, 'access', _124 => _124.matches, 'access', _125 => _125[0], 'optionalAccess', _126 => _126.params]), () => ( {}))
8849
+ });
8812
8850
  }
8813
8851
  });
8814
8852
  }
@@ -8942,12 +8980,12 @@ function RouterProvider({
8942
8980
  go: (n) => router.navigate(n),
8943
8981
  push: (to, state2, opts) => router.navigate(to, {
8944
8982
  state: state2,
8945
- preventScrollReset: _optionalChain([opts, 'optionalAccess', _121 => _121.preventScrollReset])
8983
+ preventScrollReset: _optionalChain([opts, 'optionalAccess', _127 => _127.preventScrollReset])
8946
8984
  }),
8947
8985
  replace: (to, state2, opts) => router.navigate(to, {
8948
8986
  replace: true,
8949
8987
  state: state2,
8950
- preventScrollReset: _optionalChain([opts, 'optionalAccess', _122 => _122.preventScrollReset])
8988
+ preventScrollReset: _optionalChain([opts, 'optionalAccess', _128 => _128.preventScrollReset])
8951
8989
  })
8952
8990
  };
8953
8991
  }, [router]);
@@ -9137,12 +9175,25 @@ function Await({
9137
9175
  resolve
9138
9176
  }) {
9139
9177
  let dataRouterContext = React9.useContext(DataRouterContext);
9178
+ let dataRouterStateContext = React9.useContext(DataRouterStateContext);
9179
+ let onError = React9.useCallback(
9180
+ (error, errorInfo) => {
9181
+ if (dataRouterContext && dataRouterContext.unstable_onError && dataRouterStateContext) {
9182
+ dataRouterContext.unstable_onError(error, {
9183
+ location: dataRouterStateContext.location,
9184
+ params: _optionalChain([dataRouterStateContext, 'access', _129 => _129.matches, 'optionalAccess', _130 => _130[0], 'optionalAccess', _131 => _131.params]) || {},
9185
+ errorInfo
9186
+ });
9187
+ }
9188
+ },
9189
+ [dataRouterContext, dataRouterStateContext]
9190
+ );
9140
9191
  return /* @__PURE__ */ React9.createElement(
9141
9192
  AwaitErrorBoundary,
9142
9193
  {
9143
9194
  resolve,
9144
9195
  errorElement,
9145
- unstable_onError: _optionalChain([dataRouterContext, 'optionalAccess', _123 => _123.unstable_onError])
9196
+ onError
9146
9197
  },
9147
9198
  /* @__PURE__ */ React9.createElement(ResolveAwait, null, children)
9148
9199
  );
@@ -9156,8 +9207,8 @@ var AwaitErrorBoundary = class extends React9.Component {
9156
9207
  return { error };
9157
9208
  }
9158
9209
  componentDidCatch(error, errorInfo) {
9159
- if (this.props.unstable_onError) {
9160
- this.props.unstable_onError(error, errorInfo);
9210
+ if (this.props.onError) {
9211
+ this.props.onError(error, errorInfo);
9161
9212
  } else {
9162
9213
  console.error(
9163
9214
  "<Await> caught the following error during render",
@@ -9191,7 +9242,7 @@ var AwaitErrorBoundary = class extends React9.Component {
9191
9242
  promise = resolve.then(
9192
9243
  (data2) => Object.defineProperty(resolve, "_data", { get: () => data2 }),
9193
9244
  (error) => {
9194
- _optionalChain([this, 'access', _124 => _124.props, 'access', _125 => _125.unstable_onError, 'optionalCall', _126 => _126(error)]);
9245
+ _optionalChain([this, 'access', _132 => _132.props, 'access', _133 => _133.onError, 'optionalCall', _134 => _134(error)]);
9195
9246
  Object.defineProperty(resolve, "_error", { get: () => error });
9196
9247
  }
9197
9248
  );