react-router 7.9.6 → 7.10.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.
- package/CHANGELOG.md +69 -10
- package/dist/development/{browser-C07r42Tt.d.mts → browser-BHySFrZ2.d.mts} +1 -1
- package/dist/development/{browser-BbBXFHbO.d.ts → browser-eL-tAN4R.d.ts} +1 -1
- package/dist/development/{chunk-O4JVZSOY.js → chunk-2VILFZWG.js} +167 -123
- package/dist/development/{chunk-4WY6JWTD.mjs → chunk-4BTFPFZR.mjs} +208 -221
- package/dist/development/{chunk-G3INQAYP.mjs → chunk-CECIHG5K.mjs} +15 -5
- package/dist/development/{chunk-AMVS5XVJ.js → chunk-M4WLV5HP.js} +201 -258
- package/dist/development/{chunk-PZWDWJAY.js → chunk-Z4R76DXJ.js} +7 -7
- package/dist/development/dom-export.d.mts +21 -2
- package/dist/development/dom-export.d.ts +21 -2
- package/dist/development/dom-export.js +158 -103
- package/dist/development/dom-export.mjs +133 -79
- package/dist/development/{index-react-server-client-Da3kmxNd.d.ts → index-react-server-client-CNrKUHDv.d.ts} +59 -7
- package/dist/{production/index-react-server-client-rcoGPJhU.d.mts → development/index-react-server-client-DYtvZPLT.d.mts} +59 -7
- 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-Dwf-sTWa.d.ts} +66 -8
- 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-BpU9rFBJ.d.ts → register-BnQsYkwj.d.ts} +1 -1
- package/dist/development/{register-QkB3HGjm.d.mts → register-C97Jz2jB.d.mts} +1 -1
- package/dist/development/{router-CAvh_Drx.d.mts → router-Dgz_Mh9m.d.mts} +66 -8
- package/dist/production/{browser-C07r42Tt.d.mts → browser-BHySFrZ2.d.mts} +1 -1
- package/dist/production/{browser-BbBXFHbO.d.ts → browser-eL-tAN4R.d.ts} +1 -1
- package/dist/production/{chunk-EAIF67OW.js → chunk-55FFLVQP.js} +201 -258
- package/dist/production/{chunk-QN64DHI4.js → chunk-5DTJHKF7.js} +167 -123
- package/dist/production/{chunk-FUSXQSWG.mjs → chunk-KJ5676BZ.mjs} +208 -221
- package/dist/production/{chunk-FDUMZGKM.mjs → chunk-QKAGOFED.mjs} +15 -5
- package/dist/production/{chunk-G5A35OQU.js → chunk-SGCRBGEM.js} +7 -7
- package/dist/production/dom-export.d.mts +21 -2
- package/dist/production/dom-export.d.ts +21 -2
- package/dist/production/dom-export.js +158 -103
- package/dist/production/dom-export.mjs +133 -79
- package/dist/production/{index-react-server-client-Da3kmxNd.d.ts → index-react-server-client-CNrKUHDv.d.ts} +59 -7
- package/dist/{development/index-react-server-client-rcoGPJhU.d.mts → production/index-react-server-client-DYtvZPLT.d.mts} +59 -7
- 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-Dwf-sTWa.d.ts} +66 -8
- 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-BpU9rFBJ.d.ts → register-BnQsYkwj.d.ts} +1 -1
- package/dist/production/{register-QkB3HGjm.d.mts → register-C97Jz2jB.d.mts} +1 -1
- package/dist/production/{router-CAvh_Drx.d.mts → router-Dgz_Mh9m.d.mts} +66 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,73 @@
|
|
|
1
1
|
# `react-router`
|
|
2
2
|
|
|
3
|
+
## 7.10.0-pre.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Stabilize `fetcher.reset()` ([#14545](https://github.com/remix-run/react-router/pull/14545))
|
|
8
|
+
- ⚠️ This is a breaking change if you have begun using `fetcher.unstable_reset()`
|
|
9
|
+
|
|
10
|
+
- Stabilize the `dataStrategy` `match.shouldRevalidateArgs`/`match.shouldCallHandler()` APIs. ([#14592](https://github.com/remix-run/react-router/pull/14592))
|
|
11
|
+
- The `match.shouldLoad` API is now marked deprecated in favor of these more powerful alternatives
|
|
12
|
+
- If you're using this API in a custom `dataStrategy` today, you can swap to the new API at your convenience:
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
// Before
|
|
16
|
+
const matchesToLoad = matches.filter((m) => m.shouldLoad);
|
|
17
|
+
|
|
18
|
+
// After
|
|
19
|
+
const matchesToLoad = matches.filter((m) => m.shouldCallHandler());
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- `match.shouldRevalidateArgs` is the argument that will be passed to the route `shouldRevaliate` function
|
|
23
|
+
- Combined with the parameter accepted by `match.shouldCallHandler`, you can define a custom revalidation behavior for your `dataStrategy`:
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
const matchesToLoad = matches.filter((m) => {
|
|
27
|
+
const defaultShouldRevalidate = customRevalidationBehavior(
|
|
28
|
+
match.shouldRevalidateArgs,
|
|
29
|
+
);
|
|
30
|
+
return m.shouldCallHandler(defaultShouldRevalidate);
|
|
31
|
+
// The argument here will override the internal `defaultShouldRevalidate` value
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- 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))
|
|
38
|
+
- If your `shouldRevalidate` function relied on that parameter, you may have seen unintended revalidations
|
|
39
|
+
|
|
40
|
+
- Fix `fetcher.submit` failing with plain objects containing a `tagName` property ([#14534](https://github.com/remix-run/react-router/pull/14534))
|
|
41
|
+
- [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))
|
|
42
|
+
- 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))
|
|
43
|
+
- Framework Mode + Data Mode:
|
|
44
|
+
- `<HydratedRouter unstable_transition>`/`<RouterProvider unstable_transition>`
|
|
45
|
+
- When left unset (current default behavior)
|
|
46
|
+
- Router state updates are wrapped in `React.startTransition`
|
|
47
|
+
- ⚠️ This can lead to buggy behaviors if you are wrapping your own navigations/fetchers in `React.startTransition`
|
|
48
|
+
- You should set the flag to `true` if you run into this scenario to get the enhanced `useOptimistic` behavior (requires React 19)
|
|
49
|
+
- When set to `true`
|
|
50
|
+
- Router state updates remain wrapped in `React.startTransition` (as they are without the flag)
|
|
51
|
+
- `Link`/`Form` navigations will be wrapped in `React.startTransition`
|
|
52
|
+
- A subset of router state info will be surfaced to the UI _during_ navigations via `React.useOptimistic` (i.e., `useNavigation()`, `useFetchers()`, etc.)
|
|
53
|
+
- ⚠️ This is a React 19 API so you must also be React 19 to opt into this flag for Framework/Data Mode
|
|
54
|
+
- When set to `false`
|
|
55
|
+
- The router will not leverage `React.startTransition` or `React.useOptimistic` on any navigations or state changes
|
|
56
|
+
- Declarative Mode
|
|
57
|
+
- `<BrowserRouter unstable_useTransitions>`
|
|
58
|
+
- When left unset
|
|
59
|
+
- Router state updates are wrapped in `React.startTransition`
|
|
60
|
+
- When set to `true`
|
|
61
|
+
- Router state updates remain wrapped in `React.startTransition` (as they are without the flag)
|
|
62
|
+
- `Link`/`Form` navigations will be wrapped in `React.startTransition`
|
|
63
|
+
- When set to `false`
|
|
64
|
+
- the router will not leverage `React.startTransition` on any navigations or state changes
|
|
65
|
+
|
|
66
|
+
- 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))
|
|
67
|
+
- Fix internal type error in useRoute types that surfaces when skipLibCheck is disabled ([#14577](https://github.com/remix-run/react-router/pull/14577))
|
|
68
|
+
- Preserve `statusText` on the `ErrorResponse` instance when throwing `data()` from a route handler ([#14555](https://github.com/remix-run/react-router/pull/14555))
|
|
69
|
+
- Optimize href() to avoid backtracking regex on splat ([#14329](https://github.com/remix-run/react-router/pull/14329))
|
|
70
|
+
|
|
3
71
|
## 7.9.6
|
|
4
72
|
|
|
5
73
|
### Patch Changes
|
|
@@ -61,7 +129,6 @@
|
|
|
61
129
|
- 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
130
|
|
|
63
131
|
- 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
132
|
- Framework Mode:
|
|
66
133
|
- `entry.server.tsx`: `export const unstable_instrumentations = [...]`
|
|
67
134
|
- `entry.client.tsx`: `<HydratedRouter unstable_instrumentations={[...]} />`
|
|
@@ -223,7 +290,6 @@
|
|
|
223
290
|
- Stabilize middleware and context APIs. ([#14215](https://github.com/remix-run/react-router/pull/14215))
|
|
224
291
|
|
|
225
292
|
We have removed the `unstable_` prefix from the following APIs and they are now considered stable and ready for production use:
|
|
226
|
-
|
|
227
293
|
- [`RouterContextProvider`](https://reactrouter.com/api/utils/RouterContextProvider)
|
|
228
294
|
- [`createContext`](https://reactrouter.com/api/utils/createContext)
|
|
229
295
|
- `createBrowserRouter` [`getContext`](https://reactrouter.com/api/data-routers/createBrowserRouter#optsgetcontext) option
|
|
@@ -250,7 +316,7 @@
|
|
|
250
316
|
|
|
251
317
|
- \[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
318
|
|
|
253
|
-
- server action revalidation opt out via $
|
|
319
|
+
- server action revalidation opt out via $SKIP_REVALIDATION field ([#14154](https://github.com/remix-run/react-router/pull/14154))
|
|
254
320
|
|
|
255
321
|
- Properly escape interpolated param values in `generatePath()` ([#13530](https://github.com/remix-run/react-router/pull/13530))
|
|
256
322
|
|
|
@@ -299,7 +365,6 @@
|
|
|
299
365
|
- Remove dependency on `@types/node` in TypeScript declaration files ([#14059](https://github.com/remix-run/react-router/pull/14059))
|
|
300
366
|
|
|
301
367
|
- 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
368
|
- 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
369
|
- 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
370
|
- ⚠️ 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 +398,6 @@
|
|
|
333
398
|
- \[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
399
|
|
|
335
400
|
- \[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
401
|
- The API has been renamed to `unstable_generateMiddlewareResponse` for clarity
|
|
338
402
|
- 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
403
|
- The `query` version of the API now has a signature of `(query: (r: Request) => Promise<StaticHandlerContext | Response>) => Promise<Response>`
|
|
@@ -979,7 +1043,6 @@
|
|
|
979
1043
|
```
|
|
980
1044
|
|
|
981
1045
|
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
1046
|
- Library mode - `createBrowserRouter(routes, { unstable_getContext })`
|
|
984
1047
|
- Framework mode - `<HydratedRouter unstable_getContext>`
|
|
985
1048
|
|
|
@@ -1167,7 +1230,6 @@ _No changes_
|
|
|
1167
1230
|
- Remove `future.v7_normalizeFormMethod` future flag ([#11697](https://github.com/remix-run/react-router/pull/11697))
|
|
1168
1231
|
|
|
1169
1232
|
- 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
1233
|
- `createCookie`
|
|
1172
1234
|
- `createCookieSessionStorage`
|
|
1173
1235
|
- `createMemorySessionStorage`
|
|
@@ -1176,7 +1238,6 @@ _No changes_
|
|
|
1176
1238
|
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
1239
|
|
|
1178
1240
|
Since platform-specific packages no longer need to implement this API, the following low-level APIs have been removed:
|
|
1179
|
-
|
|
1180
1241
|
- `createCookieFactory`
|
|
1181
1242
|
- `createSessionStorageFactory`
|
|
1182
1243
|
- `createCookieSessionStorageFactory`
|
|
@@ -1332,7 +1393,6 @@ _No changes_
|
|
|
1332
1393
|
```
|
|
1333
1394
|
|
|
1334
1395
|
This initial implementation targets type inference for:
|
|
1335
|
-
|
|
1336
1396
|
- `Params` : Path parameters from your routing config in `routes.ts` including file-based routing
|
|
1337
1397
|
- `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
|
|
1338
1398
|
- `ActionData` : Action data from `action` and/or `clientAction` within your route module
|
|
@@ -1347,7 +1407,6 @@ _No changes_
|
|
|
1347
1407
|
```
|
|
1348
1408
|
|
|
1349
1409
|
Check out our docs for more:
|
|
1350
|
-
|
|
1351
1410
|
- [_Explanations > Type Safety_](https://reactrouter.com/dev/guides/explanation/type-safety)
|
|
1352
1411
|
- [_How-To > Setting up type safety_](https://reactrouter.com/dev/guides/how-to/setting-up-type-safety)
|
|
1353
1412
|
|
|
@@ -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-Dgz_Mh9m.mjs';
|
|
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 './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-Dwf-sTWa.js';
|
|
3
3
|
|
|
4
4
|
type RSCRouteConfigEntryBase = {
|
|
5
5
|
action?: ActionFunction;
|