react-router 7.9.5 → 7.9.6-pre.1

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 +37 -10
  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-VNR6V74N.js → chunk-CYHICRRW.js} +124 -52
  5. package/dist/development/{chunk-UIGDSWPH.mjs → chunk-DKSAHU2I.mjs} +95 -23
  6. package/dist/{production/chunk-ERPFE3MR.js → development/chunk-HSVNPM3C.js} +93 -93
  7. package/dist/{production/chunk-CWEARR4H.js → development/chunk-OLIKX45O.js} +7 -7
  8. package/dist/development/{chunk-JG3XND5A.mjs → chunk-RGKEVI2W.mjs} +2 -2
  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/{production/index-react-server-client-BSxMvS7Z.d.ts → development/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 +25 -4
  20. package/dist/development/index-react-server.mjs +25 -4
  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/development/{router-DIAPGK5f.d.mts → 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/production/{chunk-EAE7427A.js → chunk-2DNJUQK6.js} +124 -52
  36. package/dist/{development/chunk-IXESJAGJ.js → production/chunk-EDK3MRM6.js} +93 -93
  37. package/dist/{development/chunk-FQEOJFGW.js → production/chunk-JLDESRHY.js} +7 -7
  38. package/dist/production/{chunk-TPBVZP6U.mjs → chunk-LC2OWLJG.mjs} +2 -2
  39. package/dist/production/{chunk-RZ6LZWMW.mjs → chunk-LESYMMDQ.mjs} +95 -23
  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/{development/index-react-server-client-BSxMvS7Z.d.ts → production/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 +25 -4
  51. package/dist/production/index-react-server.mjs +25 -4
  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/production/{router-DIAPGK5f.d.mts → router-CAvh_Drx.d.mts} +5 -1
  64. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # `react-router`
2
2
 
3
+ ## 7.9.6-pre.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Normalize double-slashes in `resolvePath` ([#14529](https://github.com/remix-run/react-router/pull/14529))
8
+
9
+ ## 7.9.6-pre.0
10
+
11
+ ### Patch Changes
12
+
13
+ - [UNSTABLE] Add `location`/`params` as arguments to client-side `unstable_onError` to permit enhanced error reporting. ([#14509](https://github.com/remix-run/react-router/pull/14509))
14
+
15
+ ⚠️ This is a breaking change if you've already adopted `unstable_onError`. The second `errorInfo` parameter is now an object with `location` and `params`:
16
+
17
+ ```tsx
18
+ // Before
19
+ function errorHandler(error: unknown, errorInfo?: React.errorInfo) {
20
+ /*...*/
21
+ }
22
+
23
+ // After
24
+ function errorHandler(
25
+ error: unknown,
26
+ info: {
27
+ location: Location;
28
+ params: Params;
29
+ errorInfo?: React.ErrorInfo;
30
+ },
31
+ ) {
32
+ /*...*/
33
+ }
34
+ ```
35
+
36
+ - Properly handle ancestor thrown middleware errors before `next()` on fetcher submissions ([#14517](https://github.com/remix-run/react-router/pull/14517))
37
+ - Fix issue with splat routes interfering with multiple calls to patchRoutesOnNavigation ([#14487](https://github.com/remix-run/react-router/pull/14487))
38
+
3
39
  ## 7.9.5
4
40
 
5
41
  ### Patch Changes
@@ -28,7 +64,6 @@
28
64
  - Ensure action handlers run for routes with middleware even if no loader is present ([#14443](https://github.com/remix-run/react-router/pull/14443))
29
65
 
30
66
  - Add `unstable_instrumentations` API to allow users to add observablity to their apps by instrumenting route loaders, actions, middlewares, lazy, as well as server-side request handlers and client side navigations/fetches ([#14412](https://github.com/remix-run/react-router/pull/14412))
31
-
32
67
  - Framework Mode:
33
68
  - `entry.server.tsx`: `export const unstable_instrumentations = [...]`
34
69
  - `entry.client.tsx`: `<HydratedRouter unstable_instrumentations={[...]} />`
@@ -190,7 +225,6 @@
190
225
  - Stabilize middleware and context APIs. ([#14215](https://github.com/remix-run/react-router/pull/14215))
191
226
 
192
227
  We have removed the `unstable_` prefix from the following APIs and they are now considered stable and ready for production use:
193
-
194
228
  - [`RouterContextProvider`](https://reactrouter.com/api/utils/RouterContextProvider)
195
229
  - [`createContext`](https://reactrouter.com/api/utils/createContext)
196
230
  - `createBrowserRouter` [`getContext`](https://reactrouter.com/api/data-routers/createBrowserRouter#optsgetcontext) option
@@ -217,7 +251,7 @@
217
251
 
218
252
  - \[UNSTABLE] Add `<RouterProvider unstable_onError>`/`<HydratedRouter unstable_onError>` prop for client side error reporting ([#14162](https://github.com/remix-run/react-router/pull/14162))
219
253
 
220
- - server action revalidation opt out via $SKIP\_REVALIDATION field ([#14154](https://github.com/remix-run/react-router/pull/14154))
254
+ - server action revalidation opt out via $SKIP_REVALIDATION field ([#14154](https://github.com/remix-run/react-router/pull/14154))
221
255
 
222
256
  - Properly escape interpolated param values in `generatePath()` ([#13530](https://github.com/remix-run/react-router/pull/13530))
223
257
 
@@ -266,7 +300,6 @@
266
300
  - Remove dependency on `@types/node` in TypeScript declaration files ([#14059](https://github.com/remix-run/react-router/pull/14059))
267
301
 
268
302
  - Fix types for `UIMatch` to reflect that the `loaderData`/`data` properties may be `undefined` ([#12206](https://github.com/remix-run/react-router/pull/12206))
269
-
270
303
  - When an `ErrorBoundary` is being rendered, not all active matches will have loader data available, since it may have been their `loader` that threw to trigger the boundary
271
304
  - The `UIMatch.data` type was not correctly handing this and would always reflect the presence of data, leading to the unexpected runtime errors when an `ErrorBoundary` was rendered
272
305
  - ⚠️ This may cause some type errors to show up in your code for unguarded `match.data` accesses - you should properly guard for `undefined` values in those scenarios.
@@ -300,7 +333,6 @@
300
333
  - \[UNSTABLE] When middleware is enabled, make the `context` parameter read-only (via `Readonly<unstable_RouterContextProvider>`) so that TypeScript will not allow you to write arbitrary fields to it in loaders, actions, or middleware. ([#14097](https://github.com/remix-run/react-router/pull/14097))
301
334
 
302
335
  - \[UNSTABLE] Rename and alter the signature/functionality of the `unstable_respond` API in `staticHandler.query`/`staticHandler.queryRoute` ([#14103](https://github.com/remix-run/react-router/pull/14103))
303
-
304
336
  - The API has been renamed to `unstable_generateMiddlewareResponse` for clarity
305
337
  - The main functional change is that instead of running the loaders/actions before calling `unstable_respond` and handing you the result, we now pass a `query`/`queryRoute` function as a parameter and you execute the loaders/actions inside your callback, giving you full access to pre-processing and error handling
306
338
  - The `query` version of the API now has a signature of `(query: (r: Request) => Promise<StaticHandlerContext | Response>) => Promise<Response>`
@@ -946,7 +978,6 @@
946
978
  ```
947
979
 
948
980
  Similar to server-side requests, a fresh `context` will be created per navigation (or `fetcher` call). If you have initial data you'd like to populate in the context for every request, you can provide an `unstable_getContext` function at the root of your app:
949
-
950
981
  - Library mode - `createBrowserRouter(routes, { unstable_getContext })`
951
982
  - Framework mode - `<HydratedRouter unstable_getContext>`
952
983
 
@@ -1134,7 +1165,6 @@ _No changes_
1134
1165
  - Remove `future.v7_normalizeFormMethod` future flag ([#11697](https://github.com/remix-run/react-router/pull/11697))
1135
1166
 
1136
1167
  - For Remix consumers migrating to React Router, the `crypto` global from the [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) is now required when using cookie and session APIs. This means that the following APIs are provided from `react-router` rather than platform-specific packages: ([#11837](https://github.com/remix-run/react-router/pull/11837))
1137
-
1138
1168
  - `createCookie`
1139
1169
  - `createCookieSessionStorage`
1140
1170
  - `createMemorySessionStorage`
@@ -1143,7 +1173,6 @@ _No changes_
1143
1173
  For consumers running older versions of Node, the `installGlobals` function from `@remix-run/node` has been updated to define `globalThis.crypto`, using [Node's `require('node:crypto').webcrypto` implementation.](https://nodejs.org/api/webcrypto.html)
1144
1174
 
1145
1175
  Since platform-specific packages no longer need to implement this API, the following low-level APIs have been removed:
1146
-
1147
1176
  - `createCookieFactory`
1148
1177
  - `createSessionStorageFactory`
1149
1178
  - `createCookieSessionStorageFactory`
@@ -1299,7 +1328,6 @@ _No changes_
1299
1328
  ```
1300
1329
 
1301
1330
  This initial implementation targets type inference for:
1302
-
1303
1331
  - `Params` : Path parameters from your routing config in `routes.ts` including file-based routing
1304
1332
  - `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
1305
1333
  - `ActionData` : Action data from `action` and/or `clientAction` within your route module
@@ -1314,7 +1342,6 @@ _No changes_
1314
1342
  ```
1315
1343
 
1316
1344
  Check out our docs for more:
1317
-
1318
1345
  - [_Explanations > Type Safety_](https://reactrouter.com/dev/guides/explanation/type-safety)
1319
1346
  - [_How-To > Setting up type safety_](https://reactrouter.com/dev/guides/how-to/setting-up-type-safety)
1320
1347
 
@@ -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
  "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
2
+ * react-router v7.9.6-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -811,13 +811,36 @@ function prependBasename({
811
811
  }) {
812
812
  return pathname === "/" ? basename : joinPaths([basename, pathname]);
813
813
  }
814
+ var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
815
+ var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url);
814
816
  function resolvePath(to, fromPathname = "/") {
815
817
  let {
816
818
  pathname: toPathname,
817
819
  search = "",
818
820
  hash = ""
819
821
  } = typeof to === "string" ? parsePath(to) : to;
820
- let pathname = toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;
822
+ let pathname;
823
+ if (toPathname) {
824
+ if (isAbsoluteUrl(toPathname)) {
825
+ pathname = toPathname;
826
+ } else {
827
+ if (toPathname.includes("//")) {
828
+ let oldPathname = toPathname;
829
+ toPathname = toPathname.replace(/\/\/+/g, "/");
830
+ warning(
831
+ false,
832
+ `Pathnames cannot have embedded double slashes - normalizing ${oldPathname} -> ${toPathname}`
833
+ );
834
+ }
835
+ if (toPathname.startsWith("/")) {
836
+ pathname = resolvePathname(toPathname.substring(1), "/");
837
+ } else {
838
+ pathname = resolvePathname(toPathname, fromPathname);
839
+ }
840
+ }
841
+ } else {
842
+ pathname = fromPathname;
843
+ }
821
844
  return {
822
845
  pathname,
823
846
  search: normalizeSearch(search),
@@ -1265,8 +1288,6 @@ var IDLE_BLOCKER = {
1265
1288
  reset: void 0,
1266
1289
  location: void 0
1267
1290
  };
1268
- var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
1269
- var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url);
1270
1291
  var defaultMapRouteProperties = (route) => ({
1271
1292
  hasErrorBoundary: Boolean(route.hasErrorBoundary)
1272
1293
  });
@@ -2306,6 +2327,14 @@ function createRouter(init) {
2306
2327
  key
2307
2328
  );
2308
2329
  let actionResult = actionResults[match.route.id];
2330
+ if (!actionResult) {
2331
+ for (let match2 of fetchMatches) {
2332
+ if (actionResults[match2.route.id]) {
2333
+ actionResult = actionResults[match2.route.id];
2334
+ break;
2335
+ }
2336
+ }
2337
+ }
2309
2338
  if (fetchRequest.signal.aborted) {
2310
2339
  if (fetchControllers.get(key) === abortController) {
2311
2340
  fetchControllers.delete(key);
@@ -2962,23 +2991,43 @@ function createRouter(init) {
2962
2991
  return { type: "aborted" };
2963
2992
  }
2964
2993
  let newMatches = matchRoutes(routesToUse, pathname, basename);
2994
+ let newPartialMatches = null;
2965
2995
  if (newMatches) {
2966
- return { type: "success", matches: newMatches };
2996
+ if (Object.keys(newMatches[0].params).length === 0) {
2997
+ return { type: "success", matches: newMatches };
2998
+ } else {
2999
+ newPartialMatches = matchRoutesImpl(
3000
+ routesToUse,
3001
+ pathname,
3002
+ basename,
3003
+ true
3004
+ );
3005
+ let matchedDeeper = newPartialMatches && partialMatches.length < newPartialMatches.length && compareMatches(
3006
+ partialMatches,
3007
+ newPartialMatches.slice(0, partialMatches.length)
3008
+ );
3009
+ if (!matchedDeeper) {
3010
+ return { type: "success", matches: newMatches };
3011
+ }
3012
+ }
2967
3013
  }
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
- )) {
3014
+ if (!newPartialMatches) {
3015
+ newPartialMatches = matchRoutesImpl(
3016
+ routesToUse,
3017
+ pathname,
3018
+ basename,
3019
+ true
3020
+ );
3021
+ }
3022
+ if (!newPartialMatches || compareMatches(partialMatches, newPartialMatches)) {
2977
3023
  return { type: "success", matches: null };
2978
3024
  }
2979
3025
  partialMatches = newPartialMatches;
2980
3026
  }
2981
3027
  }
3028
+ function compareMatches(a, b) {
3029
+ return a.length === b.length && a.every((m, i) => m.route.id === b[i].route.id);
3030
+ }
2982
3031
  function _internalSetRoutes(newRoutes) {
2983
3032
  manifest = {};
2984
3033
  inFlightDataRoutes = convertRoutesToDataRoutes(
@@ -6767,8 +6816,8 @@ var RenderErrorBoundary = class extends React3.Component {
6767
6816
  };
6768
6817
  }
6769
6818
  componentDidCatch(error, errorInfo) {
6770
- if (this.props.unstable_onError) {
6771
- this.props.unstable_onError(error, errorInfo);
6819
+ if (this.props.onError) {
6820
+ this.props.onError(error, errorInfo);
6772
6821
  } else {
6773
6822
  console.error(
6774
6823
  "React Router caught the following error during render",
@@ -6846,6 +6895,13 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
6846
6895
  }
6847
6896
  }
6848
6897
  }
6898
+ let onError = dataRouterState && unstable_onError ? (error, errorInfo) => {
6899
+ unstable_onError(error, {
6900
+ location: dataRouterState.location,
6901
+ params: _nullishCoalesce(_optionalChain([dataRouterState, 'access', _76 => _76.matches, 'optionalAccess', _77 => _77[0], 'optionalAccess', _78 => _78.params]), () => ( {})),
6902
+ errorInfo
6903
+ });
6904
+ } : void 0;
6849
6905
  return renderedMatches.reduceRight(
6850
6906
  (outlet, match, index) => {
6851
6907
  let error;
@@ -6906,7 +6962,7 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
6906
6962
  error,
6907
6963
  children: getChildren(),
6908
6964
  routeContext: { outlet: null, matches: matches2, isDataRoute: true },
6909
- unstable_onError
6965
+ onError
6910
6966
  }
6911
6967
  ) : getChildren();
6912
6968
  },
@@ -6988,15 +7044,15 @@ function useRouteError() {
6988
7044
  if (error !== void 0) {
6989
7045
  return error;
6990
7046
  }
6991
- return _optionalChain([state, 'access', _76 => _76.errors, 'optionalAccess', _77 => _77[routeId]]);
7047
+ return _optionalChain([state, 'access', _79 => _79.errors, 'optionalAccess', _80 => _80[routeId]]);
6992
7048
  }
6993
7049
  function useAsyncValue() {
6994
7050
  let value = React3.useContext(AwaitContext);
6995
- return _optionalChain([value, 'optionalAccess', _78 => _78._data]);
7051
+ return _optionalChain([value, 'optionalAccess', _81 => _81._data]);
6996
7052
  }
6997
7053
  function useAsyncError() {
6998
7054
  let value = React3.useContext(AwaitContext);
6999
- return _optionalChain([value, 'optionalAccess', _79 => _79._error]);
7055
+ return _optionalChain([value, 'optionalAccess', _82 => _82._error]);
7000
7056
  }
7001
7057
  var blockerId = 0;
7002
7058
  function useBlocker(shouldBlock) {
@@ -7077,7 +7133,7 @@ function useRoute(...args) {
7077
7133
  return {
7078
7134
  handle: route.route.handle,
7079
7135
  loaderData: state.loaderData[id],
7080
- actionData: _optionalChain([state, 'access', _80 => _80.actionData, 'optionalAccess', _81 => _81[id]])
7136
+ actionData: _optionalChain([state, 'access', _83 => _83.actionData, 'optionalAccess', _84 => _84[id]])
7081
7137
  };
7082
7138
  }
7083
7139
 
@@ -7122,7 +7178,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
7122
7178
  let route = manifest.routes[match.route.id];
7123
7179
  return [
7124
7180
  route && route.css ? route.css.map((href) => ({ rel: "stylesheet", href })) : [],
7125
- _optionalChain([module, 'optionalAccess', _82 => _82.links, 'optionalCall', _83 => _83()]) || []
7181
+ _optionalChain([module, 'optionalAccess', _85 => _85.links, 'optionalCall', _86 => _86()]) || []
7126
7182
  ];
7127
7183
  }).flat(2);
7128
7184
  let preloads = getModuleLinkHrefs(matches, manifest);
@@ -7223,7 +7279,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
7223
7279
  // param change, /users/123 -> /users/456
7224
7280
  currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
7225
7281
  // 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["*"]
7282
+ _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
7283
  );
7228
7284
  };
7229
7285
  if (mode === "assets") {
@@ -7246,7 +7302,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
7246
7302
  location.pathname + location.search + location.hash,
7247
7303
  window.origin
7248
7304
  ),
7249
- currentParams: _optionalChain([currentMatches, 'access', _89 => _89[0], 'optionalAccess', _90 => _90.params]) || {},
7305
+ currentParams: _optionalChain([currentMatches, 'access', _92 => _92[0], 'optionalAccess', _93 => _93.params]) || {},
7250
7306
  nextUrl: new URL(page, window.origin),
7251
7307
  nextParams: match.params,
7252
7308
  defaultShouldRevalidate: true
@@ -7518,10 +7574,10 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
7518
7574
  )
7519
7575
  });
7520
7576
  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;
7577
+ let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _94 => _94.loaderData, 'optionalAccess', _95 => _95[route.id]]) : void 0;
7522
7578
  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);
7579
+ let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _96 => _96.errors, 'optionalAccess', _97 => _97[route.id]]) : void 0;
7580
+ let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _98 => _98.clientLoader, 'optionalAccess', _99 => _99.hydrate]) === true || !route.hasLoader);
7525
7581
  dataRoute.loader = async ({ request, params, context, unstable_pattern }, singleFetch) => {
7526
7582
  try {
7527
7583
  let result = await prefetchStylesAndCallHandler(async () => {
@@ -7817,7 +7873,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
7817
7873
  function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
7818
7874
  React6.useEffect(() => {
7819
7875
  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) {
7876
+ _optionalChain([window, 'access', _100 => _100.navigator, 'optionalAccess', _101 => _101.connection, 'optionalAccess', _102 => _102.saveData]) === true) {
7821
7877
  return;
7822
7878
  }
7823
7879
  function registerElement(el) {
@@ -7926,7 +7982,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
7926
7982
  }
7927
7983
  serverPatches = await res.json();
7928
7984
  } catch (e) {
7929
- if (_optionalChain([signal, 'optionalAccess', _100 => _100.aborted])) return;
7985
+ if (_optionalChain([signal, 'optionalAccess', _103 => _103.aborted])) return;
7930
7986
  throw e;
7931
7987
  }
7932
7988
  let knownRoutes = new Set(Object.keys(manifest.routes));
@@ -8167,7 +8223,7 @@ function PrefetchPageLinksImpl({
8167
8223
  if (!manifestRoute || !manifestRoute.hasLoader) {
8168
8224
  return;
8169
8225
  }
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])) {
8226
+ 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
8227
  foundOptOutRoute = true;
8172
8228
  } else if (manifestRoute.hasClientLoader) {
8173
8229
  foundOptOutRoute = true;
@@ -8241,7 +8297,7 @@ function Meta() {
8241
8297
  error
8242
8298
  };
8243
8299
  matches[i] = match;
8244
- if (_optionalChain([routeModule, 'optionalAccess', _103 => _103.meta])) {
8300
+ if (_optionalChain([routeModule, 'optionalAccess', _106 => _106.meta])) {
8245
8301
  routeMeta = typeof routeModule.meta === "function" ? routeModule.meta({
8246
8302
  data: data2,
8247
8303
  loaderData: data2,
@@ -8340,7 +8396,7 @@ function Scripts(scriptProps) {
8340
8396
  }
8341
8397
  let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
8342
8398
  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)}` : ""};
8399
+ 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
8400
  ${matches.map((match, routeIndex) => {
8345
8401
  let routeVarName = `route${routeIndex}`;
8346
8402
  let manifestEntry = manifest.routes[match.route.id];
@@ -8570,7 +8626,7 @@ function BoundaryShell({
8570
8626
  children
8571
8627
  }) {
8572
8628
  let { routeModules } = useFrameworkContext();
8573
- if (_optionalChain([routeModules, 'access', _106 => _106.root, 'optionalAccess', _107 => _107.Layout]) && !isOutsideRemixApp) {
8629
+ if (_optionalChain([routeModules, 'access', _109 => _109.root, 'optionalAccess', _110 => _110.Layout]) && !isOutsideRemixApp) {
8574
8630
  return children;
8575
8631
  }
8576
8632
  return /* @__PURE__ */ React8.createElement("html", { lang: "en" }, /* @__PURE__ */ React8.createElement("head", null, /* @__PURE__ */ React8.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ React8.createElement(
@@ -8640,20 +8696,20 @@ var hydrationRouteProperties = [
8640
8696
  ];
8641
8697
  function createMemoryRouter(routes, opts) {
8642
8698
  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]),
8699
+ basename: _optionalChain([opts, 'optionalAccess', _111 => _111.basename]),
8700
+ getContext: _optionalChain([opts, 'optionalAccess', _112 => _112.getContext]),
8701
+ future: _optionalChain([opts, 'optionalAccess', _113 => _113.future]),
8646
8702
  history: createMemoryHistory({
8647
- initialEntries: _optionalChain([opts, 'optionalAccess', _111 => _111.initialEntries]),
8648
- initialIndex: _optionalChain([opts, 'optionalAccess', _112 => _112.initialIndex])
8703
+ initialEntries: _optionalChain([opts, 'optionalAccess', _114 => _114.initialEntries]),
8704
+ initialIndex: _optionalChain([opts, 'optionalAccess', _115 => _115.initialIndex])
8649
8705
  }),
8650
- hydrationData: _optionalChain([opts, 'optionalAccess', _113 => _113.hydrationData]),
8706
+ hydrationData: _optionalChain([opts, 'optionalAccess', _116 => _116.hydrationData]),
8651
8707
  routes,
8652
8708
  hydrationRouteProperties,
8653
8709
  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])
8710
+ dataStrategy: _optionalChain([opts, 'optionalAccess', _117 => _117.dataStrategy]),
8711
+ patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _118 => _118.patchRoutesOnNavigation]),
8712
+ unstable_instrumentations: _optionalChain([opts, 'optionalAccess', _119 => _119.unstable_instrumentations])
8657
8713
  }).initialize();
8658
8714
  }
8659
8715
  var Deferred2 = class {
@@ -8715,12 +8771,12 @@ function UNSTABLE_TransitionEnabledRouterProvider({
8715
8771
  go: (n) => router.navigate(n),
8716
8772
  push: (to, state2, opts) => router.navigate(to, {
8717
8773
  state: state2,
8718
- preventScrollReset: _optionalChain([opts, 'optionalAccess', _117 => _117.preventScrollReset])
8774
+ preventScrollReset: _optionalChain([opts, 'optionalAccess', _120 => _120.preventScrollReset])
8719
8775
  }),
8720
8776
  replace: (to, state2, opts) => router.navigate(to, {
8721
8777
  replace: true,
8722
8778
  state: state2,
8723
- preventScrollReset: _optionalChain([opts, 'optionalAccess', _118 => _118.preventScrollReset])
8779
+ preventScrollReset: _optionalChain([opts, 'optionalAccess', _121 => _121.preventScrollReset])
8724
8780
  })
8725
8781
  };
8726
8782
  }, [router]);
@@ -8807,8 +8863,11 @@ function RouterProvider({
8807
8863
  setStateImpl((prevState) => {
8808
8864
  if (newState.errors && unstable_onError) {
8809
8865
  Object.entries(newState.errors).forEach(([routeId, error]) => {
8810
- if (_optionalChain([prevState, 'access', _119 => _119.errors, 'optionalAccess', _120 => _120[routeId]]) !== error) {
8811
- unstable_onError(error);
8866
+ if (_optionalChain([prevState, 'access', _122 => _122.errors, 'optionalAccess', _123 => _123[routeId]]) !== error) {
8867
+ unstable_onError(error, {
8868
+ location: newState.location,
8869
+ params: _nullishCoalesce(_optionalChain([newState, 'access', _124 => _124.matches, 'access', _125 => _125[0], 'optionalAccess', _126 => _126.params]), () => ( {}))
8870
+ });
8812
8871
  }
8813
8872
  });
8814
8873
  }
@@ -8942,12 +9001,12 @@ function RouterProvider({
8942
9001
  go: (n) => router.navigate(n),
8943
9002
  push: (to, state2, opts) => router.navigate(to, {
8944
9003
  state: state2,
8945
- preventScrollReset: _optionalChain([opts, 'optionalAccess', _121 => _121.preventScrollReset])
9004
+ preventScrollReset: _optionalChain([opts, 'optionalAccess', _127 => _127.preventScrollReset])
8946
9005
  }),
8947
9006
  replace: (to, state2, opts) => router.navigate(to, {
8948
9007
  replace: true,
8949
9008
  state: state2,
8950
- preventScrollReset: _optionalChain([opts, 'optionalAccess', _122 => _122.preventScrollReset])
9009
+ preventScrollReset: _optionalChain([opts, 'optionalAccess', _128 => _128.preventScrollReset])
8951
9010
  })
8952
9011
  };
8953
9012
  }, [router]);
@@ -9137,12 +9196,25 @@ function Await({
9137
9196
  resolve
9138
9197
  }) {
9139
9198
  let dataRouterContext = React9.useContext(DataRouterContext);
9199
+ let dataRouterStateContext = React9.useContext(DataRouterStateContext);
9200
+ let onError = React9.useCallback(
9201
+ (error, errorInfo) => {
9202
+ if (dataRouterContext && dataRouterContext.unstable_onError && dataRouterStateContext) {
9203
+ dataRouterContext.unstable_onError(error, {
9204
+ location: dataRouterStateContext.location,
9205
+ params: _optionalChain([dataRouterStateContext, 'access', _129 => _129.matches, 'optionalAccess', _130 => _130[0], 'optionalAccess', _131 => _131.params]) || {},
9206
+ errorInfo
9207
+ });
9208
+ }
9209
+ },
9210
+ [dataRouterContext, dataRouterStateContext]
9211
+ );
9140
9212
  return /* @__PURE__ */ React9.createElement(
9141
9213
  AwaitErrorBoundary,
9142
9214
  {
9143
9215
  resolve,
9144
9216
  errorElement,
9145
- unstable_onError: _optionalChain([dataRouterContext, 'optionalAccess', _123 => _123.unstable_onError])
9217
+ onError
9146
9218
  },
9147
9219
  /* @__PURE__ */ React9.createElement(ResolveAwait, null, children)
9148
9220
  );
@@ -9156,8 +9228,8 @@ var AwaitErrorBoundary = class extends React9.Component {
9156
9228
  return { error };
9157
9229
  }
9158
9230
  componentDidCatch(error, errorInfo) {
9159
- if (this.props.unstable_onError) {
9160
- this.props.unstable_onError(error, errorInfo);
9231
+ if (this.props.onError) {
9232
+ this.props.onError(error, errorInfo);
9161
9233
  } else {
9162
9234
  console.error(
9163
9235
  "<Await> caught the following error during render",
@@ -9191,7 +9263,7 @@ var AwaitErrorBoundary = class extends React9.Component {
9191
9263
  promise = resolve.then(
9192
9264
  (data2) => Object.defineProperty(resolve, "_data", { get: () => data2 }),
9193
9265
  (error) => {
9194
- _optionalChain([this, 'access', _124 => _124.props, 'access', _125 => _125.unstable_onError, 'optionalCall', _126 => _126(error)]);
9266
+ _optionalChain([this, 'access', _132 => _132.props, 'access', _133 => _133.onError, 'optionalCall', _134 => _134(error)]);
9195
9267
  Object.defineProperty(resolve, "_error", { get: () => error });
9196
9268
  }
9197
9269
  );