react-router 7.9.6 → 7.10.0-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.
- package/CHANGELOG.md +75 -10
- package/dist/development/{browser-BbBXFHbO.d.ts → browser-BpxEZgZC.d.ts} +1 -1
- package/dist/development/{browser-C07r42Tt.d.mts → browser-C5z6FZmz.d.mts} +1 -1
- package/dist/development/{chunk-4WY6JWTD.mjs → chunk-GIMUO62I.mjs} +208 -221
- package/dist/development/{chunk-AMVS5XVJ.js → chunk-KQLPIZ7E.js} +201 -258
- package/dist/development/{chunk-PZWDWJAY.js → chunk-RHWHYDYZ.js} +7 -7
- package/dist/development/{chunk-G3INQAYP.mjs → chunk-V5RTLP6E.mjs} +15 -5
- package/dist/development/{chunk-O4JVZSOY.js → chunk-XHWAND4X.js} +167 -123
- package/dist/development/dom-export.d.mts +29 -10
- package/dist/development/dom-export.d.ts +29 -10
- package/dist/development/dom-export.js +158 -103
- package/dist/development/dom-export.mjs +133 -79
- package/dist/{production/index-react-server-client-Da3kmxNd.d.ts → development/index-react-server-client-CCjKYJTH.d.ts} +75 -180
- package/dist/development/{index-react-server-client-rcoGPJhU.d.mts → index-react-server-client-CipGfVBI.d.mts} +75 -180
- package/dist/development/index-react-server-client.d.mts +2 -2
- package/dist/development/index-react-server-client.d.ts +2 -2
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +19 -4
- package/dist/development/index-react-server.d.ts +19 -4
- package/dist/development/index-react-server.js +30 -24
- package/dist/development/index-react-server.mjs +30 -24
- package/dist/development/index.d.mts +19 -15
- package/dist/development/index.d.ts +19 -15
- package/dist/development/index.js +92 -82
- package/dist/development/index.mjs +3 -3
- package/dist/{production/instrumentation-Unc20tLk.d.ts → development/instrumentation-BB0wRuqz.d.ts} +93 -11
- package/dist/development/lib/types/internal.d.mts +2 -2
- package/dist/development/lib/types/internal.d.ts +2 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-QkB3HGjm.d.mts → register-C1RwVJAt.d.mts} +1 -1
- package/dist/development/{register-BpU9rFBJ.d.ts → register-ODDAAYlf.d.ts} +1 -1
- package/dist/development/{router-CAvh_Drx.d.mts → router-CwNp5l9u.d.mts} +93 -11
- package/dist/production/{browser-BbBXFHbO.d.ts → browser-BpxEZgZC.d.ts} +1 -1
- package/dist/production/{browser-C07r42Tt.d.mts → browser-C5z6FZmz.d.mts} +1 -1
- package/dist/production/{chunk-QN64DHI4.js → chunk-3MVZKESN.js} +167 -123
- package/dist/production/{chunk-FUSXQSWG.mjs → chunk-7F5XUDXM.mjs} +208 -221
- package/dist/production/{chunk-EAIF67OW.js → chunk-C7S4I3K5.js} +201 -258
- package/dist/production/{chunk-FDUMZGKM.mjs → chunk-ISOIFGFA.mjs} +15 -5
- package/dist/production/{chunk-G5A35OQU.js → chunk-YU3WNS3T.js} +7 -7
- package/dist/production/dom-export.d.mts +29 -10
- package/dist/production/dom-export.d.ts +29 -10
- package/dist/production/dom-export.js +158 -103
- package/dist/production/dom-export.mjs +133 -79
- package/dist/{development/index-react-server-client-Da3kmxNd.d.ts → production/index-react-server-client-CCjKYJTH.d.ts} +75 -180
- package/dist/production/{index-react-server-client-rcoGPJhU.d.mts → index-react-server-client-CipGfVBI.d.mts} +75 -180
- package/dist/production/index-react-server-client.d.mts +2 -2
- package/dist/production/index-react-server-client.d.ts +2 -2
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +19 -4
- package/dist/production/index-react-server.d.ts +19 -4
- package/dist/production/index-react-server.js +30 -24
- package/dist/production/index-react-server.mjs +30 -24
- package/dist/production/index.d.mts +19 -15
- package/dist/production/index.d.ts +19 -15
- package/dist/production/index.js +92 -82
- package/dist/production/index.mjs +3 -3
- package/dist/{development/instrumentation-Unc20tLk.d.ts → production/instrumentation-BB0wRuqz.d.ts} +93 -11
- package/dist/production/lib/types/internal.d.mts +2 -2
- package/dist/production/lib/types/internal.d.ts +2 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/{register-QkB3HGjm.d.mts → register-C1RwVJAt.d.mts} +1 -1
- package/dist/production/{register-BpU9rFBJ.d.ts → register-ODDAAYlf.d.ts} +1 -1
- package/dist/production/{router-CAvh_Drx.d.mts → router-CwNp5l9u.d.mts} +93 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,79 @@
|
|
|
1
1
|
# `react-router`
|
|
2
2
|
|
|
3
|
+
## 7.10.0-pre.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [REMOVE] Update source code docs ([`1f8fee408`](https://github.com/remix-run/react-router/commit/1f8fee408db2f74dcc4b04eeb51009da5d51d8a6))
|
|
8
|
+
|
|
9
|
+
## 7.10.0-pre.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- Stabilize `fetcher.reset()` ([#14545](https://github.com/remix-run/react-router/pull/14545))
|
|
14
|
+
- ⚠️ This is a breaking change if you have begun using `fetcher.unstable_reset()`
|
|
15
|
+
|
|
16
|
+
- Stabilize the `dataStrategy` `match.shouldRevalidateArgs`/`match.shouldCallHandler()` APIs. ([#14592](https://github.com/remix-run/react-router/pull/14592))
|
|
17
|
+
- The `match.shouldLoad` API is now marked deprecated in favor of these more powerful alternatives
|
|
18
|
+
- If you're using this API in a custom `dataStrategy` today, you can swap to the new API at your convenience:
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
// Before
|
|
22
|
+
const matchesToLoad = matches.filter((m) => m.shouldLoad);
|
|
23
|
+
|
|
24
|
+
// After
|
|
25
|
+
const matchesToLoad = matches.filter((m) => m.shouldCallHandler());
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
- `match.shouldRevalidateArgs` is the argument that will be passed to the route `shouldRevaliate` function
|
|
29
|
+
- Combined with the parameter accepted by `match.shouldCallHandler`, you can define a custom revalidation behavior for your `dataStrategy`:
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
const matchesToLoad = matches.filter((m) => {
|
|
33
|
+
const defaultShouldRevalidate = customRevalidationBehavior(
|
|
34
|
+
match.shouldRevalidateArgs,
|
|
35
|
+
);
|
|
36
|
+
return m.shouldCallHandler(defaultShouldRevalidate);
|
|
37
|
+
// The argument here will override the internal `defaultShouldRevalidate` value
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Fix a Framework Mode bug where the `defaultShouldRevalidate` parameter to `shouldRevalidate` would not be correct after `action` returned a 4xx/5xx response (`true` when it should have been `false`) ([#14592](https://github.com/remix-run/react-router/pull/14592))
|
|
44
|
+
- If your `shouldRevalidate` function relied on that parameter, you may have seen unintended revalidations
|
|
45
|
+
|
|
46
|
+
- Fix `fetcher.submit` failing with plain objects containing a `tagName` property ([#14534](https://github.com/remix-run/react-router/pull/14534))
|
|
47
|
+
- [UNSTABLE] Add `unstable_pattern` to the parameters for client side `unstable_onError`, refactor how it's called by `RouterProvider` to avoid potential strict mode issues ([#14573](https://github.com/remix-run/react-router/pull/14573))
|
|
48
|
+
- Add new `unstable_useTransitions` flag to routers to give users control over the usage of [`React.startTransition`](https://react.dev/reference/react/startTransition) and [`React.useOptimistic`](https://react.dev/reference/react/useOptimistic). ([#14524](https://github.com/remix-run/react-router/pull/14524))
|
|
49
|
+
- Framework Mode + Data Mode:
|
|
50
|
+
- `<HydratedRouter unstable_transition>`/`<RouterProvider unstable_transition>`
|
|
51
|
+
- When left unset (current default behavior)
|
|
52
|
+
- Router state updates are wrapped in `React.startTransition`
|
|
53
|
+
- ⚠️ This can lead to buggy behaviors if you are wrapping your own navigations/fetchers in `React.startTransition`
|
|
54
|
+
- You should set the flag to `true` if you run into this scenario to get the enhanced `useOptimistic` behavior (requires React 19)
|
|
55
|
+
- When set to `true`
|
|
56
|
+
- Router state updates remain wrapped in `React.startTransition` (as they are without the flag)
|
|
57
|
+
- `Link`/`Form` navigations will be wrapped in `React.startTransition`
|
|
58
|
+
- A subset of router state info will be surfaced to the UI _during_ navigations via `React.useOptimistic` (i.e., `useNavigation()`, `useFetchers()`, etc.)
|
|
59
|
+
- ⚠️ This is a React 19 API so you must also be React 19 to opt into this flag for Framework/Data Mode
|
|
60
|
+
- When set to `false`
|
|
61
|
+
- The router will not leverage `React.startTransition` or `React.useOptimistic` on any navigations or state changes
|
|
62
|
+
- Declarative Mode
|
|
63
|
+
- `<BrowserRouter unstable_useTransitions>`
|
|
64
|
+
- When left unset
|
|
65
|
+
- Router state updates are wrapped in `React.startTransition`
|
|
66
|
+
- When set to `true`
|
|
67
|
+
- Router state updates remain wrapped in `React.startTransition` (as they are without the flag)
|
|
68
|
+
- `Link`/`Form` navigations will be wrapped in `React.startTransition`
|
|
69
|
+
- When set to `false`
|
|
70
|
+
- the router will not leverage `React.startTransition` on any navigations or state changes
|
|
71
|
+
|
|
72
|
+
- Fix the promise returned from `useNavigate` in Framework/Data Mode so that it properly tracks the duration of `popstate` navigations (i.e., `navigate(-1)`) ([#14524](https://github.com/remix-run/react-router/pull/14524))
|
|
73
|
+
- Fix internal type error in useRoute types that surfaces when skipLibCheck is disabled ([#14577](https://github.com/remix-run/react-router/pull/14577))
|
|
74
|
+
- Preserve `statusText` on the `ErrorResponse` instance when throwing `data()` from a route handler ([#14555](https://github.com/remix-run/react-router/pull/14555))
|
|
75
|
+
- Optimize href() to avoid backtracking regex on splat ([#14329](https://github.com/remix-run/react-router/pull/14329))
|
|
76
|
+
|
|
3
77
|
## 7.9.6
|
|
4
78
|
|
|
5
79
|
### Patch Changes
|
|
@@ -61,7 +135,6 @@
|
|
|
61
135
|
- Ensure action handlers run for routes with middleware even if no loader is present ([#14443](https://github.com/remix-run/react-router/pull/14443))
|
|
62
136
|
|
|
63
137
|
- 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))
|
|
64
|
-
|
|
65
138
|
- Framework Mode:
|
|
66
139
|
- `entry.server.tsx`: `export const unstable_instrumentations = [...]`
|
|
67
140
|
- `entry.client.tsx`: `<HydratedRouter unstable_instrumentations={[...]} />`
|
|
@@ -223,7 +296,6 @@
|
|
|
223
296
|
- Stabilize middleware and context APIs. ([#14215](https://github.com/remix-run/react-router/pull/14215))
|
|
224
297
|
|
|
225
298
|
We have removed the `unstable_` prefix from the following APIs and they are now considered stable and ready for production use:
|
|
226
|
-
|
|
227
299
|
- [`RouterContextProvider`](https://reactrouter.com/api/utils/RouterContextProvider)
|
|
228
300
|
- [`createContext`](https://reactrouter.com/api/utils/createContext)
|
|
229
301
|
- `createBrowserRouter` [`getContext`](https://reactrouter.com/api/data-routers/createBrowserRouter#optsgetcontext) option
|
|
@@ -250,7 +322,7 @@
|
|
|
250
322
|
|
|
251
323
|
- \[UNSTABLE] Add `<RouterProvider unstable_onError>`/`<HydratedRouter unstable_onError>` prop for client side error reporting ([#14162](https://github.com/remix-run/react-router/pull/14162))
|
|
252
324
|
|
|
253
|
-
- server action revalidation opt out via $
|
|
325
|
+
- server action revalidation opt out via $SKIP_REVALIDATION field ([#14154](https://github.com/remix-run/react-router/pull/14154))
|
|
254
326
|
|
|
255
327
|
- Properly escape interpolated param values in `generatePath()` ([#13530](https://github.com/remix-run/react-router/pull/13530))
|
|
256
328
|
|
|
@@ -299,7 +371,6 @@
|
|
|
299
371
|
- Remove dependency on `@types/node` in TypeScript declaration files ([#14059](https://github.com/remix-run/react-router/pull/14059))
|
|
300
372
|
|
|
301
373
|
- Fix types for `UIMatch` to reflect that the `loaderData`/`data` properties may be `undefined` ([#12206](https://github.com/remix-run/react-router/pull/12206))
|
|
302
|
-
|
|
303
374
|
- 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
|
|
304
375
|
- 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
|
|
305
376
|
- ⚠️ 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.
|
|
@@ -333,7 +404,6 @@
|
|
|
333
404
|
- \[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))
|
|
334
405
|
|
|
335
406
|
- \[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))
|
|
336
|
-
|
|
337
407
|
- The API has been renamed to `unstable_generateMiddlewareResponse` for clarity
|
|
338
408
|
- 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
|
|
339
409
|
- The `query` version of the API now has a signature of `(query: (r: Request) => Promise<StaticHandlerContext | Response>) => Promise<Response>`
|
|
@@ -979,7 +1049,6 @@
|
|
|
979
1049
|
```
|
|
980
1050
|
|
|
981
1051
|
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:
|
|
982
|
-
|
|
983
1052
|
- Library mode - `createBrowserRouter(routes, { unstable_getContext })`
|
|
984
1053
|
- Framework mode - `<HydratedRouter unstable_getContext>`
|
|
985
1054
|
|
|
@@ -1167,7 +1236,6 @@ _No changes_
|
|
|
1167
1236
|
- Remove `future.v7_normalizeFormMethod` future flag ([#11697](https://github.com/remix-run/react-router/pull/11697))
|
|
1168
1237
|
|
|
1169
1238
|
- 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))
|
|
1170
|
-
|
|
1171
1239
|
- `createCookie`
|
|
1172
1240
|
- `createCookieSessionStorage`
|
|
1173
1241
|
- `createMemorySessionStorage`
|
|
@@ -1176,7 +1244,6 @@ _No changes_
|
|
|
1176
1244
|
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)
|
|
1177
1245
|
|
|
1178
1246
|
Since platform-specific packages no longer need to implement this API, the following low-level APIs have been removed:
|
|
1179
|
-
|
|
1180
1247
|
- `createCookieFactory`
|
|
1181
1248
|
- `createSessionStorageFactory`
|
|
1182
1249
|
- `createCookieSessionStorageFactory`
|
|
@@ -1332,7 +1399,6 @@ _No changes_
|
|
|
1332
1399
|
```
|
|
1333
1400
|
|
|
1334
1401
|
This initial implementation targets type inference for:
|
|
1335
|
-
|
|
1336
1402
|
- `Params` : Path parameters from your routing config in `routes.ts` including file-based routing
|
|
1337
1403
|
- `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
|
|
1338
1404
|
- `ActionData` : Action data from `action` and/or `clientAction` within your route module
|
|
@@ -1347,7 +1413,6 @@ _No changes_
|
|
|
1347
1413
|
```
|
|
1348
1414
|
|
|
1349
1415
|
Check out our docs for more:
|
|
1350
|
-
|
|
1351
1416
|
- [_Explanations > Type Safety_](https://reactrouter.com/dev/guides/explanation/type-safety)
|
|
1352
1417
|
- [_How-To > Setting up type safety_](https://reactrouter.com/dev/guides/how-to/setting-up-type-safety)
|
|
1353
1418
|
|
|
@@ -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-
|
|
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';
|
|
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-
|
|
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-CwNp5l9u.mjs';
|
|
3
3
|
|
|
4
4
|
type RSCRouteConfigEntryBase = {
|
|
5
5
|
action?: ActionFunction;
|