react-router 7.8.0-pre.2 → 7.8.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 (30) hide show
  1. package/CHANGELOG.md +51 -48
  2. package/dist/development/{chunk-74TFO7SN.js → chunk-EVX7OBGB.js} +82 -51
  3. package/dist/development/{chunk-3D24XHV2.mjs → chunk-HZX6U7MI.mjs} +2 -2
  4. package/dist/{production/chunk-GSF7DANI.js → development/chunk-VC6RBZTR.js} +130 -130
  5. package/dist/development/{chunk-WSV33ENW.mjs → chunk-ZYFC6VSF.mjs} +47 -16
  6. package/dist/development/dom-export.js +3 -3
  7. package/dist/development/dom-export.mjs +3 -3
  8. package/dist/development/index-react-server-client.js +4 -4
  9. package/dist/development/index-react-server-client.mjs +2 -2
  10. package/dist/development/index-react-server.js +1 -1
  11. package/dist/development/index-react-server.mjs +1 -1
  12. package/dist/development/index.js +98 -98
  13. package/dist/development/index.mjs +3 -3
  14. package/dist/development/lib/types/internal.js +1 -1
  15. package/dist/development/lib/types/internal.mjs +1 -1
  16. package/dist/production/{chunk-DDK3XFL6.js → chunk-BOD6JCOU.js} +82 -51
  17. package/dist/{development/chunk-HQ37R3FK.js → production/chunk-O6DRQPUD.js} +130 -130
  18. package/dist/production/{chunk-IEIDJVF4.mjs → chunk-SIHON65V.mjs} +47 -16
  19. package/dist/production/{chunk-Q6IGLNPQ.mjs → chunk-XPGU3ZMH.mjs} +2 -2
  20. package/dist/production/dom-export.js +3 -3
  21. package/dist/production/dom-export.mjs +3 -3
  22. package/dist/production/index-react-server-client.js +4 -4
  23. package/dist/production/index-react-server-client.mjs +2 -2
  24. package/dist/production/index-react-server.js +1 -1
  25. package/dist/production/index-react-server.mjs +1 -1
  26. package/dist/production/index.js +98 -98
  27. package/dist/production/index.mjs +3 -3
  28. package/dist/production/lib/types/internal.js +1 -1
  29. package/dist/production/lib/types/internal.mjs +1 -1
  30. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.8.0-pre.2
2
+ * react-router v7.8.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -3920,12 +3920,36 @@ async function defaultDataStrategyWithMiddleware(args) {
3920
3920
  if (!args.matches.some((m) => m.route.unstable_middleware)) {
3921
3921
  return defaultDataStrategy(args);
3922
3922
  }
3923
+ let didCallHandler = false;
3923
3924
  return runClientMiddlewarePipeline(
3924
3925
  args,
3925
- () => defaultDataStrategy(args),
3926
- (error, routeId) => ({ [routeId]: { type: "error", result: error } })
3926
+ () => {
3927
+ didCallHandler = true;
3928
+ return defaultDataStrategy(args);
3929
+ },
3930
+ (error, routeId) => clientMiddlewareErrorHandler(
3931
+ error,
3932
+ routeId,
3933
+ args.matches,
3934
+ didCallHandler
3935
+ )
3927
3936
  );
3928
3937
  }
3938
+ function clientMiddlewareErrorHandler(error, routeId, matches, didCallHandler) {
3939
+ if (didCallHandler) {
3940
+ return {
3941
+ [routeId]: { type: "error", result: error }
3942
+ };
3943
+ } else {
3944
+ let boundaryRouteId = findNearestBoundary(
3945
+ matches,
3946
+ matches.find((m) => m.route.id === routeId || m.route.loader)?.route.id || routeId
3947
+ ).route.id;
3948
+ return {
3949
+ [boundaryRouteId]: { type: "error", result: error }
3950
+ };
3951
+ }
3952
+ }
3929
3953
  async function runServerMiddlewarePipeline(args, handler, errorHandler) {
3930
3954
  let { matches, request, params, context } = args;
3931
3955
  let tuples = matches.flatMap(
@@ -4200,20 +4224,27 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
4200
4224
  );
4201
4225
  } : (cb) => {
4202
4226
  let typedDataStrategyArgs = dataStrategyArgs;
4227
+ let didCallHandler = false;
4203
4228
  return runClientMiddlewarePipeline(
4204
4229
  typedDataStrategyArgs,
4205
- () => cb({
4206
- ...typedDataStrategyArgs,
4207
- fetcherKey,
4208
- unstable_runClientMiddleware: () => {
4209
- throw new Error(
4210
- "Cannot call `unstable_runClientMiddleware()` from within an `unstable_runClientMiddleware` handler"
4211
- );
4212
- }
4213
- }),
4214
- (error, routeId) => ({
4215
- [routeId]: { type: "error", result: error }
4216
- })
4230
+ () => {
4231
+ didCallHandler = true;
4232
+ return cb({
4233
+ ...typedDataStrategyArgs,
4234
+ fetcherKey,
4235
+ unstable_runClientMiddleware: () => {
4236
+ throw new Error(
4237
+ "Cannot call `unstable_runClientMiddleware()` from within an `unstable_runClientMiddleware` handler"
4238
+ );
4239
+ }
4240
+ });
4241
+ },
4242
+ (error, routeId) => clientMiddlewareErrorHandler(
4243
+ error,
4244
+ routeId,
4245
+ matches,
4246
+ didCallHandler
4247
+ )
4217
4248
  );
4218
4249
  };
4219
4250
  let results = await dataStrategyImpl({
@@ -8941,7 +8972,7 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
8941
8972
  try {
8942
8973
  if (isBrowser) {
8943
8974
  window.__reactRouterVersion = // @ts-expect-error
8944
- "7.8.0-pre.2";
8975
+ "7.8.0";
8945
8976
  }
8946
8977
  } catch (e) {
8947
8978
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.8.0-pre.2
2
+ * react-router v7.8.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -57,7 +57,7 @@ import {
57
57
  withComponentProps,
58
58
  withErrorBoundaryProps,
59
59
  withHydrateFallbackProps
60
- } from "./chunk-IEIDJVF4.mjs";
60
+ } from "./chunk-SIHON65V.mjs";
61
61
 
62
62
  // lib/dom/ssr/server.tsx
63
63
  import * as React from "react";
@@ -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 _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.8.0-pre.2
2
+ * react-router v7.8.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -11,7 +11,7 @@
11
11
  "use client";
12
12
 
13
13
 
14
- var _chunkDDK3XFL6js = require('./chunk-DDK3XFL6.js');
14
+ var _chunkBOD6JCOUjs = require('./chunk-BOD6JCOU.js');
15
15
 
16
16
  // lib/dom-export/dom-router-provider.tsx
17
17
  var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react);
@@ -180,7 +180,7 @@ function HydratedRouter(props) {
180
180
  }, []);
181
181
  React2.useEffect(() => {
182
182
  if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
183
- document.querySelectorAll(`[${_chunkDDK3XFL6js.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
183
+ document.querySelectorAll(`[${_chunkBOD6JCOUjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
184
184
  }
185
185
  }, [criticalCss]);
186
186
  let [location, setLocation] = React2.useState(router.state.location);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.8.0-pre.2
2
+ * react-router v7.8.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -12,7 +12,7 @@
12
12
  import {
13
13
  deserializeErrors,
14
14
  getHydrationData
15
- } from "./chunk-Q6IGLNPQ.mjs";
15
+ } from "./chunk-XPGU3ZMH.mjs";
16
16
  import {
17
17
  CRITICAL_CSS_DATA_ATTRIBUTE,
18
18
  FrameworkContext,
@@ -29,7 +29,7 @@ import {
29
29
  invariant,
30
30
  mapRouteProperties,
31
31
  useFogOFWarDiscovery
32
- } from "./chunk-IEIDJVF4.mjs";
32
+ } from "./chunk-SIHON65V.mjs";
33
33
 
34
34
  // lib/dom-export/dom-router-provider.tsx
35
35
  import * as React from "react";
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
2
- * react-router v7.8.0-pre.2
2
+ * react-router v7.8.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -30,11 +30,11 @@
30
30
 
31
31
 
32
32
 
33
- var _chunkGSF7DANIjs = require('./chunk-GSF7DANI.js');
33
+ var _chunkO6DRQPUDjs = require('./chunk-O6DRQPUD.js');
34
34
 
35
35
 
36
36
 
37
- var _chunkDDK3XFL6js = require('./chunk-DDK3XFL6.js');
37
+ var _chunkBOD6JCOUjs = require('./chunk-BOD6JCOU.js');
38
38
 
39
39
 
40
40
 
@@ -58,4 +58,4 @@ var _chunkDDK3XFL6js = require('./chunk-DDK3XFL6.js');
58
58
 
59
59
 
60
60
 
61
- exports.Await = _chunkGSF7DANIjs.Await; exports.BrowserRouter = _chunkGSF7DANIjs.BrowserRouter; exports.Form = _chunkGSF7DANIjs.Form; exports.HashRouter = _chunkGSF7DANIjs.HashRouter; exports.Link = _chunkGSF7DANIjs.Link; exports.Links = _chunkDDK3XFL6js.Links; exports.MemoryRouter = _chunkGSF7DANIjs.MemoryRouter; exports.Meta = _chunkDDK3XFL6js.Meta; exports.NavLink = _chunkGSF7DANIjs.NavLink; exports.Navigate = _chunkGSF7DANIjs.Navigate; exports.Outlet = _chunkGSF7DANIjs.Outlet; exports.Route = _chunkGSF7DANIjs.Route; exports.Router = _chunkGSF7DANIjs.Router; exports.RouterProvider = _chunkGSF7DANIjs.RouterProvider; exports.Routes = _chunkGSF7DANIjs.Routes; exports.ScrollRestoration = _chunkGSF7DANIjs.ScrollRestoration; exports.StaticRouter = _chunkGSF7DANIjs.StaticRouter; exports.StaticRouterProvider = _chunkGSF7DANIjs.StaticRouterProvider; exports.UNSAFE_WithComponentProps = _chunkGSF7DANIjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkGSF7DANIjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkGSF7DANIjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkGSF7DANIjs.HistoryRouter;
61
+ exports.Await = _chunkO6DRQPUDjs.Await; exports.BrowserRouter = _chunkO6DRQPUDjs.BrowserRouter; exports.Form = _chunkO6DRQPUDjs.Form; exports.HashRouter = _chunkO6DRQPUDjs.HashRouter; exports.Link = _chunkO6DRQPUDjs.Link; exports.Links = _chunkBOD6JCOUjs.Links; exports.MemoryRouter = _chunkO6DRQPUDjs.MemoryRouter; exports.Meta = _chunkBOD6JCOUjs.Meta; exports.NavLink = _chunkO6DRQPUDjs.NavLink; exports.Navigate = _chunkO6DRQPUDjs.Navigate; exports.Outlet = _chunkO6DRQPUDjs.Outlet; exports.Route = _chunkO6DRQPUDjs.Route; exports.Router = _chunkO6DRQPUDjs.Router; exports.RouterProvider = _chunkO6DRQPUDjs.RouterProvider; exports.Routes = _chunkO6DRQPUDjs.Routes; exports.ScrollRestoration = _chunkO6DRQPUDjs.ScrollRestoration; exports.StaticRouter = _chunkO6DRQPUDjs.StaticRouter; exports.StaticRouterProvider = _chunkO6DRQPUDjs.StaticRouterProvider; exports.UNSAFE_WithComponentProps = _chunkO6DRQPUDjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkO6DRQPUDjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkO6DRQPUDjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkO6DRQPUDjs.HistoryRouter;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.8.0-pre.2
2
+ * react-router v7.8.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -32,7 +32,7 @@ import {
32
32
  WithComponentProps,
33
33
  WithErrorBoundaryProps,
34
34
  WithHydrateFallbackProps
35
- } from "./chunk-IEIDJVF4.mjs";
35
+ } from "./chunk-SIHON65V.mjs";
36
36
  export {
37
37
  Await,
38
38
  BrowserRouter,
@@ -27,7 +27,7 @@ function _interopNamespace(e) {
27
27
  var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
28
28
 
29
29
  /**
30
- * react-router v7.8.0-pre.2
30
+ * react-router v7.8.0
31
31
  *
32
32
  * Copyright (c) Remix Software Inc.
33
33
  *
@@ -6,7 +6,7 @@ export { Await, BrowserRouter, Form, HashRouter, Link, Links, MemoryRouter, Meta
6
6
  import { serialize, parse } from 'cookie';
7
7
 
8
8
  /**
9
- * react-router v7.8.0-pre.2
9
+ * react-router v7.8.0
10
10
  *
11
11
  * Copyright (c) Remix Software Inc.
12
12
  *