react-router 7.13.1-pre.0 → 7.13.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 +31 -12
- package/dist/{production/chunk-ZXYVKLN7.js → development/chunk-2YMDXNOJ.js} +99 -99
- package/dist/development/{chunk-BPFEYQ6M.mjs → chunk-JPUPSTYD.mjs} +2 -2
- package/dist/{production/chunk-I63A6YSE.js → development/chunk-KSEWV2VO.js} +7 -7
- package/dist/development/{chunk-WQZSGSJA.mjs → chunk-LFPYN7LY.mjs} +2 -2
- package/dist/development/{chunk-LF5SS6XE.js → chunk-XOLAXE2Z.js} +1 -1
- package/dist/development/dom-export.js +27 -27
- package/dist/development/dom-export.mjs +3 -3
- 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.js +1 -1
- package/dist/development/index-react-server.mjs +1 -1
- package/dist/development/index.js +82 -82
- package/dist/development/index.mjs +3 -3
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/production/{chunk-XCKC4VBJ.js → chunk-772H4TVR.js} +1 -1
- package/dist/{development/chunk-TC44ITIJ.js → production/chunk-B5UMK6O7.js} +99 -99
- package/dist/production/{chunk-2K4LVAAG.mjs → chunk-RJCJ3EYF.mjs} +2 -2
- package/dist/production/{chunk-ROHSFSEU.mjs → chunk-TXB4YXR2.mjs} +2 -2
- package/dist/{development/chunk-CGPAOPIJ.js → production/chunk-ZJMCM6KT.js} +7 -7
- package/dist/production/dom-export.js +27 -27
- package/dist/production/dom-export.mjs +3 -3
- 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.js +1 -1
- package/dist/production/index-react-server.mjs +1 -1
- package/dist/production/index.js +82 -82
- package/dist/production/index.mjs +3 -3
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
# `react-router`
|
|
2
2
|
|
|
3
|
-
## 7.13.1
|
|
3
|
+
## 7.13.1
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- fix null reference exception in bad codepath leading to invalid route tree comparisons ([#14780](https://github.com/remix-run/react-router/pull/14780))
|
|
8
|
+
|
|
8
9
|
- fix: clear timeout when turbo-stream encoding completes ([#14810](https://github.com/remix-run/react-router/pull/14810))
|
|
10
|
+
|
|
9
11
|
- Improve error message when Origin header is invalid ([#14743](https://github.com/remix-run/react-router/pull/14743))
|
|
12
|
+
|
|
10
13
|
- Fix matchPath optional params matching without a "/" separator. ([#14689](https://github.com/remix-run/react-router/pull/14689))
|
|
11
14
|
- matchPath("/users/:id?", "/usersblah") now returns null.
|
|
12
|
-
- matchPath("/
|
|
15
|
+
- matchPath("/test\_route/:part?", "/test\_route\_more") now returns null.
|
|
16
|
+
|
|
17
|
+
- add RSC unstable\_getRequest ([#14758](https://github.com/remix-run/react-router/pull/14758))
|
|
13
18
|
|
|
14
|
-
- add RSC unstable_getRequest ([#14758](https://github.com/remix-run/react-router/pull/14758))
|
|
15
19
|
- Fix `HydrateFallback` rendering during initial lazy route discovery with matching splat route ([#14740](https://github.com/remix-run/react-router/pull/14740))
|
|
16
|
-
|
|
20
|
+
|
|
21
|
+
- \[UNSTABLE] Add support for `<Link unstable_mask>` in Data Mode which allows users to navigate to a URL in the router but "mask" the URL displayed in the browser. This is useful for contextual routing usages such as displaying an image in a model on top of a gallery, but displaying a browser URL directly to the image that can be shared and loaded without the contextual gallery in the background. ([#14716](https://github.com/remix-run/react-router/pull/14716))
|
|
17
22
|
|
|
18
23
|
```tsx
|
|
19
24
|
// routes/gallery.tsx
|
|
@@ -55,11 +60,13 @@
|
|
|
55
60
|
```
|
|
56
61
|
|
|
57
62
|
Notes:
|
|
63
|
+
|
|
58
64
|
- The masked location, if present, will be available on `useLocation().unstable_mask` so you can detect whether you are currently masked or not.
|
|
59
65
|
- Masked URLs only work for SPA use cases, and will be removed from `history.state` during SSR.
|
|
60
66
|
- This provides a first-class API to mask URLs in Data Mode to achieve the same behavior you could do in Declarative Mode via [manual `backgroundLocation` management](https://github.com/remix-run/react-router/tree/main/examples/modal).
|
|
61
67
|
|
|
62
68
|
- RSC: Update failed origin checks to return a 400 status and appropriate UI instead of a generic 500 ([#14755](https://github.com/remix-run/react-router/pull/14755))
|
|
69
|
+
|
|
63
70
|
- Preserve query parameters and hash on manifest version mismatch reload ([#14813](https://github.com/remix-run/react-router/pull/14813))
|
|
64
71
|
|
|
65
72
|
## 7.13.0
|
|
@@ -99,25 +106,25 @@
|
|
|
99
106
|
|
|
100
107
|
| URL `/a/b/c` | **HTTP pathname** | **`request` pathname\`** |
|
|
101
108
|
| ------------ | ----------------- | ------------------------ |
|
|
102
|
-
| **Document** | `/a/b/c` | `/a/b/c` ✅
|
|
103
|
-
| **Data** | `/a/b/c.data` | `/a/b/c` ✅
|
|
109
|
+
| **Document** | `/a/b/c` | `/a/b/c` ✅ |
|
|
110
|
+
| **Data** | `/a/b/c.data` | `/a/b/c` ✅ |
|
|
104
111
|
|
|
105
112
|
| URL `/a/b/c/` | **HTTP pathname** | **`request` pathname\`** |
|
|
106
113
|
| ------------- | ----------------- | ------------------------ |
|
|
107
|
-
| **Document** | `/a/b/c/` | `/a/b/c/` ✅
|
|
114
|
+
| **Document** | `/a/b/c/` | `/a/b/c/` ✅ |
|
|
108
115
|
| **Data** | `/a/b/c.data` | `/a/b/c` ⚠️ |
|
|
109
116
|
|
|
110
117
|
With this flag enabled, these pathnames will be made consistent though a new `_.data` format for client-side `.data` requests:
|
|
111
118
|
|
|
112
119
|
| URL `/a/b/c` | **HTTP pathname** | **`request` pathname\`** |
|
|
113
120
|
| ------------ | ----------------- | ------------------------ |
|
|
114
|
-
| **Document** | `/a/b/c` | `/a/b/c` ✅
|
|
115
|
-
| **Data** | `/a/b/c.data` | `/a/b/c` ✅
|
|
121
|
+
| **Document** | `/a/b/c` | `/a/b/c` ✅ |
|
|
122
|
+
| **Data** | `/a/b/c.data` | `/a/b/c` ✅ |
|
|
116
123
|
|
|
117
124
|
| URL `/a/b/c/` | **HTTP pathname** | **`request` pathname\`** |
|
|
118
125
|
| ------------- | ------------------ | ------------------------ |
|
|
119
|
-
| **Document** | `/a/b/c/` | `/a/b/c/` ✅
|
|
120
|
-
| **Data** | `/a/b/c/_.data` ⬅️ | `/a/b/c/` ✅
|
|
126
|
+
| **Document** | `/a/b/c/` | `/a/b/c/` ✅ |
|
|
127
|
+
| **Data** | `/a/b/c/_.data` ⬅️ | `/a/b/c/` ✅ |
|
|
121
128
|
|
|
122
129
|
This a bug fix but we are putting it behind an opt-in flag because it has the potential to be a "breaking bug fix" if you are relying on the URL format for any other application or caching logic.
|
|
123
130
|
|
|
@@ -144,12 +151,14 @@
|
|
|
144
151
|
- \[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))
|
|
145
152
|
|
|
146
153
|
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.
|
|
154
|
+
|
|
147
155
|
- `<Form method="post" unstable_defaultShouldRevalidate={false}>`
|
|
148
156
|
- `submit(data, { method: "post", unstable_defaultShouldRevalidate: false })`
|
|
149
157
|
- `<fetcher.Form method="post" unstable_defaultShouldRevalidate={false}>`
|
|
150
158
|
- `fetcher.submit(data, { method: "post", unstable_defaultShouldRevalidate: false })`
|
|
151
159
|
|
|
152
160
|
This is also available on non-submission APIs that may trigger revalidations due to changing search params:
|
|
161
|
+
|
|
153
162
|
- `<Link to="/" unstable_defaultShouldRevalidate={false}>`
|
|
154
163
|
- `navigate("/?foo=bar", { unstable_defaultShouldRevalidate: false })`
|
|
155
164
|
- `setSearchParams(params, { unstable_defaultShouldRevalidate: false })`
|
|
@@ -172,6 +181,7 @@
|
|
|
172
181
|
- ⚠️ This is a breaking change if you have begun using `fetcher.unstable_reset()`
|
|
173
182
|
|
|
174
183
|
- Stabilize the `dataStrategy` `match.shouldRevalidateArgs`/`match.shouldCallHandler()` APIs. ([#14592](https://github.com/remix-run/react-router/pull/14592))
|
|
184
|
+
|
|
175
185
|
- The `match.shouldLoad` API is now marked deprecated in favor of these more powerful alternatives
|
|
176
186
|
|
|
177
187
|
- If you're using this API in a custom `dataStrategy` today, you can swap to the new API at your convenience:
|
|
@@ -300,6 +310,7 @@
|
|
|
300
310
|
- Ensure action handlers run for routes with middleware even if no loader is present ([#14443](https://github.com/remix-run/react-router/pull/14443))
|
|
301
311
|
|
|
302
312
|
- 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))
|
|
313
|
+
|
|
303
314
|
- Framework Mode:
|
|
304
315
|
- `entry.server.tsx`: `export const unstable_instrumentations = [...]`
|
|
305
316
|
- `entry.client.tsx`: `<HydratedRouter unstable_instrumentations={[...]} />`
|
|
@@ -461,6 +472,7 @@
|
|
|
461
472
|
- Stabilize middleware and context APIs. ([#14215](https://github.com/remix-run/react-router/pull/14215))
|
|
462
473
|
|
|
463
474
|
We have removed the `unstable_` prefix from the following APIs and they are now considered stable and ready for production use:
|
|
475
|
+
|
|
464
476
|
- [`RouterContextProvider`](https://reactrouter.com/api/utils/RouterContextProvider)
|
|
465
477
|
- [`createContext`](https://reactrouter.com/api/utils/createContext)
|
|
466
478
|
- `createBrowserRouter` [`getContext`](https://reactrouter.com/api/data-routers/createBrowserRouter#optsgetcontext) option
|
|
@@ -487,7 +499,7 @@
|
|
|
487
499
|
|
|
488
500
|
- \[UNSTABLE] Add `<RouterProvider unstable_onError>`/`<HydratedRouter unstable_onError>` prop for client side error reporting ([#14162](https://github.com/remix-run/react-router/pull/14162))
|
|
489
501
|
|
|
490
|
-
- server action revalidation opt out via $
|
|
502
|
+
- server action revalidation opt out via $SKIP\_REVALIDATION field ([#14154](https://github.com/remix-run/react-router/pull/14154))
|
|
491
503
|
|
|
492
504
|
- Properly escape interpolated param values in `generatePath()` ([#13530](https://github.com/remix-run/react-router/pull/13530))
|
|
493
505
|
|
|
@@ -536,6 +548,7 @@
|
|
|
536
548
|
- Remove dependency on `@types/node` in TypeScript declaration files ([#14059](https://github.com/remix-run/react-router/pull/14059))
|
|
537
549
|
|
|
538
550
|
- Fix types for `UIMatch` to reflect that the `loaderData`/`data` properties may be `undefined` ([#12206](https://github.com/remix-run/react-router/pull/12206))
|
|
551
|
+
|
|
539
552
|
- 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
|
|
540
553
|
- 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
|
|
541
554
|
- ⚠️ 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.
|
|
@@ -569,6 +582,7 @@
|
|
|
569
582
|
- \[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))
|
|
570
583
|
|
|
571
584
|
- \[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))
|
|
585
|
+
|
|
572
586
|
- The API has been renamed to `unstable_generateMiddlewareResponse` for clarity
|
|
573
587
|
- 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
|
|
574
588
|
- The `query` version of the API now has a signature of `(query: (r: Request) => Promise<StaticHandlerContext | Response>) => Promise<Response>`
|
|
@@ -1214,6 +1228,7 @@
|
|
|
1214
1228
|
```
|
|
1215
1229
|
|
|
1216
1230
|
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:
|
|
1231
|
+
|
|
1217
1232
|
- Library mode - `createBrowserRouter(routes, { unstable_getContext })`
|
|
1218
1233
|
- Framework mode - `<HydratedRouter unstable_getContext>`
|
|
1219
1234
|
|
|
@@ -1401,6 +1416,7 @@ _No changes_
|
|
|
1401
1416
|
- Remove `future.v7_normalizeFormMethod` future flag ([#11697](https://github.com/remix-run/react-router/pull/11697))
|
|
1402
1417
|
|
|
1403
1418
|
- 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))
|
|
1419
|
+
|
|
1404
1420
|
- `createCookie`
|
|
1405
1421
|
- `createCookieSessionStorage`
|
|
1406
1422
|
- `createMemorySessionStorage`
|
|
@@ -1409,6 +1425,7 @@ _No changes_
|
|
|
1409
1425
|
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)
|
|
1410
1426
|
|
|
1411
1427
|
Since platform-specific packages no longer need to implement this API, the following low-level APIs have been removed:
|
|
1428
|
+
|
|
1412
1429
|
- `createCookieFactory`
|
|
1413
1430
|
- `createSessionStorageFactory`
|
|
1414
1431
|
- `createCookieSessionStorageFactory`
|
|
@@ -1564,6 +1581,7 @@ _No changes_
|
|
|
1564
1581
|
```
|
|
1565
1582
|
|
|
1566
1583
|
This initial implementation targets type inference for:
|
|
1584
|
+
|
|
1567
1585
|
- `Params` : Path parameters from your routing config in `routes.ts` including file-based routing
|
|
1568
1586
|
- `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
|
|
1569
1587
|
- `ActionData` : Action data from `action` and/or `clientAction` within your route module
|
|
@@ -1578,6 +1596,7 @@ _No changes_
|
|
|
1578
1596
|
```
|
|
1579
1597
|
|
|
1580
1598
|
Check out our docs for more:
|
|
1599
|
+
|
|
1581
1600
|
- [_Explanations > Type Safety_](https://reactrouter.com/dev/guides/explanation/type-safety)
|
|
1582
1601
|
- [_How-To > Setting up type safety_](https://reactrouter.com/dev/guides/how-to/setting-up-type-safety)
|
|
1583
1602
|
|