react-router 7.10.1 → 7.11.0-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 (68) hide show
  1. package/CHANGELOG.md +29 -11
  2. package/dist/development/{browser-BpxEZgZC.d.ts → browser-Cv4JZyZ5.d.mts} +4 -3
  3. package/dist/{production/browser-BpxEZgZC.d.ts → development/browser-o-qhcuhA.d.ts} +4 -3
  4. package/dist/{production/chunk-B3F6YMOF.js → development/chunk-JKMHOZYW.js} +111 -121
  5. package/dist/development/{chunk-WWGJGFF6.mjs → chunk-KRMLYMWA.mjs} +231 -74
  6. package/dist/{production/chunk-YO5R3LGQ.js → development/chunk-OVG6YSZ5.js} +7 -7
  7. package/dist/development/{chunk-PMGK554W.mjs → chunk-QMKP6CC3.mjs} +147 -38
  8. package/dist/development/{chunk-RBZI3ZHD.js → chunk-UO7KGW2U.js} +279 -110
  9. package/dist/development/dom-export.d.mts +11 -10
  10. package/dist/development/dom-export.d.ts +12 -11
  11. package/dist/development/dom-export.js +30 -31
  12. package/dist/development/dom-export.mjs +6 -7
  13. package/dist/{production/index-react-server-client-CCjKYJTH.d.ts → development/index-react-server-client-Cv5Q9lf0.d.ts} +60 -14
  14. package/dist/development/{index-react-server-client-CipGfVBI.d.mts → index-react-server-client-P7VgYu6T.d.mts} +60 -14
  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.d.mts +4 -2
  20. package/dist/development/index-react-server.d.ts +4 -2
  21. package/dist/development/index-react-server.js +72 -19
  22. package/dist/development/index-react-server.mjs +72 -19
  23. package/dist/development/index.d.mts +17 -16
  24. package/dist/development/index.d.ts +17 -16
  25. package/dist/development/index.js +220 -111
  26. package/dist/development/index.mjs +3 -3
  27. package/dist/{production/instrumentation-BB0wRuqz.d.ts → development/instrumentation-BlrVzjbg.d.ts} +30 -15
  28. package/dist/development/lib/types/internal.d.mts +2 -2
  29. package/dist/development/lib/types/internal.d.ts +2 -2
  30. package/dist/development/lib/types/internal.js +1 -1
  31. package/dist/development/lib/types/internal.mjs +1 -1
  32. package/dist/development/{register-ODDAAYlf.d.ts → register-BGQUMCK4.d.ts} +1 -1
  33. package/dist/development/{register-C1RwVJAt.d.mts → register-DTJJbt1o.d.mts} +1 -1
  34. package/dist/development/{router-CwNp5l9u.d.mts → router-5fbeEIMQ.d.mts} +30 -15
  35. package/dist/{development/browser-C5z6FZmz.d.mts → production/browser-Cv4JZyZ5.d.mts} +4 -3
  36. package/dist/production/{browser-C5z6FZmz.d.mts → browser-o-qhcuhA.d.ts} +4 -3
  37. package/dist/production/{chunk-UQPBOMFP.js → chunk-AO22ZXHI.js} +279 -110
  38. package/dist/production/{chunk-ANIOYBQK.mjs → chunk-IDHO4Q57.mjs} +231 -74
  39. package/dist/production/{chunk-TDCOAFPJ.mjs → chunk-J4JITZ76.mjs} +147 -38
  40. package/dist/{development/chunk-HMTWJNYB.js → production/chunk-M5W3Q3T5.js} +111 -121
  41. package/dist/{development/chunk-FKYGG5Z2.js → production/chunk-YGB3JEIP.js} +7 -7
  42. package/dist/production/dom-export.d.mts +11 -10
  43. package/dist/production/dom-export.d.ts +12 -11
  44. package/dist/production/dom-export.js +30 -31
  45. package/dist/production/dom-export.mjs +6 -7
  46. package/dist/{development/index-react-server-client-CCjKYJTH.d.ts → production/index-react-server-client-Cv5Q9lf0.d.ts} +60 -14
  47. package/dist/production/{index-react-server-client-CipGfVBI.d.mts → index-react-server-client-P7VgYu6T.d.mts} +60 -14
  48. package/dist/production/index-react-server-client.d.mts +2 -2
  49. package/dist/production/index-react-server-client.d.ts +2 -2
  50. package/dist/production/index-react-server-client.js +4 -4
  51. package/dist/production/index-react-server-client.mjs +2 -2
  52. package/dist/production/index-react-server.d.mts +4 -2
  53. package/dist/production/index-react-server.d.ts +4 -2
  54. package/dist/production/index-react-server.js +72 -19
  55. package/dist/production/index-react-server.mjs +72 -19
  56. package/dist/production/index.d.mts +17 -16
  57. package/dist/production/index.d.ts +17 -16
  58. package/dist/production/index.js +220 -111
  59. package/dist/production/index.mjs +3 -3
  60. package/dist/{development/instrumentation-BB0wRuqz.d.ts → production/instrumentation-BlrVzjbg.d.ts} +30 -15
  61. package/dist/production/lib/types/internal.d.mts +2 -2
  62. package/dist/production/lib/types/internal.d.ts +2 -2
  63. package/dist/production/lib/types/internal.js +1 -1
  64. package/dist/production/lib/types/internal.mjs +1 -1
  65. package/dist/production/{register-ODDAAYlf.d.ts → register-BGQUMCK4.d.ts} +1 -1
  66. package/dist/production/{register-C1RwVJAt.d.mts → register-DTJJbt1o.d.mts} +1 -1
  67. package/dist/production/{router-CwNp5l9u.d.mts → router-5fbeEIMQ.d.mts} +30 -15
  68. package/package.json +5 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # `react-router`
2
2
 
3
+ ## 7.11.0-pre.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Stabilize `<HydratedRouter onError>`/`<RouterProvider onError>` ([#14546](https://github.com/remix-run/react-router/pull/14546))
8
+
9
+ ### Patch Changes
10
+
11
+ - add support for throwing redirect Response's at RSC render time ([#14596](https://github.com/remix-run/react-router/pull/14596))
12
+ - Support for throwing `data()` and Response from server component render phase. Response body is not serialized as async work is not allowed as error encoding phase. If you wish to transmit data to the boundary, throw `data()` instead. ([#14632](https://github.com/remix-run/react-router/pull/14632))
13
+ - Fix `unstable_useTransitions` prop on `<Router>` component to permit omission for backewards compatibility ([#14646](https://github.com/remix-run/react-router/pull/14646))
14
+ - `routeRSCServerRequest` replace `fetchServer` with `serverResponse` ([#14597](https://github.com/remix-run/react-router/pull/14597))
15
+ - [UNSTABLE] Add a new `unstable_defaultShouldRevalidate` flag to various APIs to allow opt-ing out of standard revalidation behaviors. ([#14542](https://github.com/remix-run/react-router/pull/14542))
16
+
17
+ If active routes include a `shouldRevalidate` function, then your value will be passed as `defaultShouldRevalidate` in those function so that the route always has the final revalidation determination.
18
+ - `<Form method="post" unstable_defaultShouldRevalidate={false}>`
19
+ - `submit(data, { method: "post", unstable_defaultShouldRevalidate: false })`
20
+ - `<fetcher.Form method="post" unstable_defaultShouldRevalidate={false}>`
21
+ - `fetcher.submit(data, { method: "post", unstable_defaultShouldRevalidate: false })`
22
+
23
+ This is also available on non-submission APIs that may trigger revalidations due to changing search params:
24
+ - `<Link to="/" unstable_defaultShouldRevalidate={false}>`
25
+ - `navigate("/?foo=bar", { unstable_defaultShouldRevalidate: false })`
26
+ - `setSearchParams(params, { unstable_defaultShouldRevalidate: false })`
27
+
28
+ - Allow redirects to be returned from client side middleware ([#14598](https://github.com/remix-run/react-router/pull/14598))
29
+ - Handle `dataStrategy` implementations that return insufficient result sets by adding errors for routes without any available result ([#14627](https://github.com/remix-run/react-router/pull/14627))
30
+
3
31
  ## 7.10.1
4
32
 
5
33
  ### Patch Changes
@@ -14,7 +42,6 @@
14
42
  - ⚠️ This is a breaking change if you have begun using `fetcher.unstable_reset()`
15
43
 
16
44
  - Stabilize the `dataStrategy` `match.shouldRevalidateArgs`/`match.shouldCallHandler()` APIs. ([#14592](https://github.com/remix-run/react-router/pull/14592))
17
-
18
45
  - The `match.shouldLoad` API is now marked deprecated in favor of these more powerful alternatives
19
46
 
20
47
  - If you're using this API in a custom `dataStrategy` today, you can swap to the new API at your convenience:
@@ -143,7 +170,6 @@
143
170
  - Ensure action handlers run for routes with middleware even if no loader is present ([#14443](https://github.com/remix-run/react-router/pull/14443))
144
171
 
145
172
  - 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))
146
-
147
173
  - Framework Mode:
148
174
  - `entry.server.tsx`: `export const unstable_instrumentations = [...]`
149
175
  - `entry.client.tsx`: `<HydratedRouter unstable_instrumentations={[...]} />`
@@ -305,7 +331,6 @@
305
331
  - Stabilize middleware and context APIs. ([#14215](https://github.com/remix-run/react-router/pull/14215))
306
332
 
307
333
  We have removed the `unstable_` prefix from the following APIs and they are now considered stable and ready for production use:
308
-
309
334
  - [`RouterContextProvider`](https://reactrouter.com/api/utils/RouterContextProvider)
310
335
  - [`createContext`](https://reactrouter.com/api/utils/createContext)
311
336
  - `createBrowserRouter` [`getContext`](https://reactrouter.com/api/data-routers/createBrowserRouter#optsgetcontext) option
@@ -332,7 +357,7 @@
332
357
 
333
358
  - \[UNSTABLE] Add `<RouterProvider unstable_onError>`/`<HydratedRouter unstable_onError>` prop for client side error reporting ([#14162](https://github.com/remix-run/react-router/pull/14162))
334
359
 
335
- - server action revalidation opt out via $SKIP\_REVALIDATION field ([#14154](https://github.com/remix-run/react-router/pull/14154))
360
+ - server action revalidation opt out via $SKIP_REVALIDATION field ([#14154](https://github.com/remix-run/react-router/pull/14154))
336
361
 
337
362
  - Properly escape interpolated param values in `generatePath()` ([#13530](https://github.com/remix-run/react-router/pull/13530))
338
363
 
@@ -381,7 +406,6 @@
381
406
  - Remove dependency on `@types/node` in TypeScript declaration files ([#14059](https://github.com/remix-run/react-router/pull/14059))
382
407
 
383
408
  - Fix types for `UIMatch` to reflect that the `loaderData`/`data` properties may be `undefined` ([#12206](https://github.com/remix-run/react-router/pull/12206))
384
-
385
409
  - 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
386
410
  - 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
387
411
  - ⚠️ 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.
@@ -415,7 +439,6 @@
415
439
  - \[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))
416
440
 
417
441
  - \[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))
418
-
419
442
  - The API has been renamed to `unstable_generateMiddlewareResponse` for clarity
420
443
  - 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
421
444
  - The `query` version of the API now has a signature of `(query: (r: Request) => Promise<StaticHandlerContext | Response>) => Promise<Response>`
@@ -1061,7 +1084,6 @@
1061
1084
  ```
1062
1085
 
1063
1086
  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:
1064
-
1065
1087
  - Library mode - `createBrowserRouter(routes, { unstable_getContext })`
1066
1088
  - Framework mode - `<HydratedRouter unstable_getContext>`
1067
1089
 
@@ -1249,7 +1271,6 @@ _No changes_
1249
1271
  - Remove `future.v7_normalizeFormMethod` future flag ([#11697](https://github.com/remix-run/react-router/pull/11697))
1250
1272
 
1251
1273
  - 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))
1252
-
1253
1274
  - `createCookie`
1254
1275
  - `createCookieSessionStorage`
1255
1276
  - `createMemorySessionStorage`
@@ -1258,7 +1279,6 @@ _No changes_
1258
1279
  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)
1259
1280
 
1260
1281
  Since platform-specific packages no longer need to implement this API, the following low-level APIs have been removed:
1261
-
1262
1282
  - `createCookieFactory`
1263
1283
  - `createSessionStorageFactory`
1264
1284
  - `createCookieSessionStorageFactory`
@@ -1414,7 +1434,6 @@ _No changes_
1414
1434
  ```
1415
1435
 
1416
1436
  This initial implementation targets type inference for:
1417
-
1418
1437
  - `Params` : Path parameters from your routing config in `routes.ts` including file-based routing
1419
1438
  - `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
1420
1439
  - `ActionData` : Action data from `action` and/or `clientAction` within your route module
@@ -1429,7 +1448,6 @@ _No changes_
1429
1448
  ```
1430
1449
 
1431
1450
  Check out our docs for more:
1432
-
1433
1451
  - [_Explanations > Type Safety_](https://reactrouter.com/dev/guides/explanation/type-safety)
1434
1452
  - [_How-To > Setting up type safety_](https://reactrouter.com/dev/guides/how-to/setting-up-type-safety)
1435
1453
 
@@ -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-BB0wRuqz.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 './router-5fbeEIMQ.mjs';
3
3
 
4
4
  type RSCRouteConfigEntryBase = {
5
5
  action?: ActionFunction;
@@ -93,7 +93,7 @@ type RSCMatch = {
93
93
  };
94
94
  type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
95
95
  type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
96
- type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: {
96
+ type DecodeReplyFunction = (reply: FormData | string, options: {
97
97
  temporaryReferences: unknown;
98
98
  }) => Promise<unknown[]>;
99
99
  type LoadServerActionFunction = (id: string) => Promise<Function>;
@@ -178,7 +178,8 @@ declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename,
178
178
  onError?: (error: unknown) => void;
179
179
  request: Request;
180
180
  routes: RSCRouteConfigEntry[];
181
- generateResponse: (match: RSCMatch, { temporaryReferences, }: {
181
+ generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: {
182
+ onError(error: unknown): string | undefined;
182
183
  temporaryReferences: unknown;
183
184
  }) => Response;
184
185
  }): Promise<Response>;
@@ -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-BB0wRuqz.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-BlrVzjbg.js';
3
3
 
4
4
  type RSCRouteConfigEntryBase = {
5
5
  action?: ActionFunction;
@@ -93,7 +93,7 @@ type RSCMatch = {
93
93
  };
94
94
  type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
95
95
  type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
96
- type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: {
96
+ type DecodeReplyFunction = (reply: FormData | string, options: {
97
97
  temporaryReferences: unknown;
98
98
  }) => Promise<unknown[]>;
99
99
  type LoadServerActionFunction = (id: string) => Promise<Function>;
@@ -178,7 +178,8 @@ declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename,
178
178
  onError?: (error: unknown) => void;
179
179
  request: Request;
180
180
  routes: RSCRouteConfigEntry[];
181
- generateResponse: (match: RSCMatch, { temporaryReferences, }: {
181
+ generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: {
182
+ onError(error: unknown): string | undefined;
182
183
  temporaryReferences: unknown;
183
184
  }) => Response;
184
185
  }): Promise<Response>;