react-router 7.14.0 → 7.14.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.
Files changed (72) hide show
  1. package/CHANGELOG.md +17 -24
  2. package/dist/development/{browser-C9Ar1yxG.d.ts → browser-CtktEGQs.d.ts} +2 -2
  3. package/dist/development/{browser-vtIR1Kpe.d.mts → browser-D-3-U2Jj.d.mts} +2 -2
  4. package/dist/development/{chunk-NXTEWSJO.js → chunk-3F6IB66O.js} +99 -99
  5. package/dist/development/{chunk-WAVMRYR2.js → chunk-7VLQJKNG.js} +7 -7
  6. package/dist/development/{chunk-2UH5WJXA.mjs → chunk-BFXCU3MI.mjs} +2 -2
  7. package/dist/development/{chunk-QFMPRPBF.mjs → chunk-OE4NN4TA.mjs} +24 -14
  8. package/dist/development/{chunk-IK6APEEG.js → chunk-YMKMFAYZ.js} +23 -13
  9. package/dist/{production/context-phCt_zmH.d.mts → development/context-BzhbVly6.d.mts} +1 -1
  10. package/dist/development/dom-export.d.mts +3 -3
  11. package/dist/development/dom-export.d.ts +3 -3
  12. package/dist/development/dom-export.js +27 -27
  13. package/dist/development/dom-export.mjs +3 -3
  14. package/dist/development/{index-react-server-client-luDbagNU.d.ts → index-react-server-client-CimaPp9o.d.ts} +2 -2
  15. package/dist/{production/index-react-server-client-BwWaHAr3.d.mts → development/index-react-server-client-WSaoxloq.d.mts} +2 -2
  16. package/dist/development/index-react-server-client.d.mts +3 -3
  17. package/dist/development/index-react-server-client.d.ts +3 -3
  18. package/dist/development/index-react-server-client.js +4 -4
  19. package/dist/development/index-react-server-client.mjs +2 -2
  20. package/dist/development/index-react-server.d.mts +6 -0
  21. package/dist/development/index-react-server.d.ts +6 -0
  22. package/dist/development/index-react-server.js +9 -6
  23. package/dist/development/index-react-server.mjs +9 -6
  24. package/dist/development/index.d.mts +10 -10
  25. package/dist/development/index.d.ts +10 -10
  26. package/dist/development/index.js +82 -82
  27. package/dist/development/index.mjs +3 -3
  28. package/dist/{production/instrumentation-BYr6ff5D.d.ts → development/instrumentation-CMVbvxj9.d.ts} +1 -1
  29. package/dist/development/lib/types/internal.d.mts +2 -2
  30. package/dist/development/lib/types/internal.d.ts +2 -2
  31. package/dist/development/lib/types/internal.js +1 -1
  32. package/dist/development/lib/types/internal.mjs +1 -1
  33. package/dist/development/{register-CkcGwv27.d.ts → register-D1WlEpq9.d.ts} +1 -1
  34. package/dist/development/{register-CTxsJBKQ.d.mts → register-aE9ob3TK.d.mts} +1 -1
  35. package/dist/development/{routeModules-CA7kSxJJ.d.ts → routeModules-CM_clkdE.d.ts} +6 -0
  36. package/dist/development/{routeModules-BRrCYrSL.d.mts → routeModules-Djumx26z.d.mts} +6 -0
  37. package/dist/production/{browser-C9Ar1yxG.d.ts → browser-CtktEGQs.d.ts} +2 -2
  38. package/dist/production/{browser-vtIR1Kpe.d.mts → browser-D-3-U2Jj.d.mts} +2 -2
  39. package/dist/production/{chunk-355DUZMC.js → chunk-3SUPTI2U.js} +7 -7
  40. package/dist/production/{chunk-X5LK27NZ.mjs → chunk-G5ZWO7Q6.mjs} +2 -2
  41. package/dist/production/{chunk-FPT5DLVJ.js → chunk-LIOP3ILM.js} +99 -99
  42. package/dist/production/{chunk-HZQGQD2X.mjs → chunk-SPR7R4GU.mjs} +24 -14
  43. package/dist/production/{chunk-4TJ7T2OQ.js → chunk-UVEQGZIH.js} +23 -13
  44. package/dist/{development/context-phCt_zmH.d.mts → production/context-BzhbVly6.d.mts} +1 -1
  45. package/dist/production/dom-export.d.mts +3 -3
  46. package/dist/production/dom-export.d.ts +3 -3
  47. package/dist/production/dom-export.js +27 -27
  48. package/dist/production/dom-export.mjs +3 -3
  49. package/dist/production/{index-react-server-client-luDbagNU.d.ts → index-react-server-client-CimaPp9o.d.ts} +2 -2
  50. package/dist/{development/index-react-server-client-BwWaHAr3.d.mts → production/index-react-server-client-WSaoxloq.d.mts} +2 -2
  51. package/dist/production/index-react-server-client.d.mts +3 -3
  52. package/dist/production/index-react-server-client.d.ts +3 -3
  53. package/dist/production/index-react-server-client.js +4 -4
  54. package/dist/production/index-react-server-client.mjs +2 -2
  55. package/dist/production/index-react-server.d.mts +6 -0
  56. package/dist/production/index-react-server.d.ts +6 -0
  57. package/dist/production/index-react-server.js +9 -6
  58. package/dist/production/index-react-server.mjs +9 -6
  59. package/dist/production/index.d.mts +10 -10
  60. package/dist/production/index.d.ts +10 -10
  61. package/dist/production/index.js +82 -82
  62. package/dist/production/index.mjs +3 -3
  63. package/dist/{development/instrumentation-BYr6ff5D.d.ts → production/instrumentation-CMVbvxj9.d.ts} +1 -1
  64. package/dist/production/lib/types/internal.d.mts +2 -2
  65. package/dist/production/lib/types/internal.d.ts +2 -2
  66. package/dist/production/lib/types/internal.js +1 -1
  67. package/dist/production/lib/types/internal.mjs +1 -1
  68. package/dist/production/{register-CkcGwv27.d.ts → register-D1WlEpq9.d.ts} +1 -1
  69. package/dist/production/{register-CTxsJBKQ.d.mts → register-aE9ob3TK.d.mts} +1 -1
  70. package/dist/production/{routeModules-CA7kSxJJ.d.ts → routeModules-CM_clkdE.d.ts} +6 -0
  71. package/dist/production/{routeModules-BRrCYrSL.d.mts → routeModules-Djumx26z.d.mts} +6 -0
  72. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # `react-router`
2
2
 
3
+ ## v7.14.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix a potential race condition that can occur when rendering a `HydrateFallback` and initial loaders land before the `router.subscribe` call happens in the `RouterProvider` layout effect
8
+ - Normalize double-slashes in redirect paths
9
+
3
10
  ## 7.14.0
4
11
 
5
12
  ### Patch Changes
@@ -82,7 +89,6 @@
82
89
  By default, React Router normalizes the `request.url` passed to your `loader`, `action`, and `middleware` functions by removing React Router's internal implementation details (`.data` suffixes, `index` + `_routes` query params).
83
90
 
84
91
  Enabling this flag removes that normalization and passes the raw HTTP `request` instance to your handlers. This provides a few benefits:
85
-
86
92
  - Reduces server-side overhead by eliminating multiple `new Request()` calls on the critical path
87
93
  - Allows you to distinguish document from data requests in your handlers base don the presence of a `.data` suffix (useful for observability purposes)
88
94
 
@@ -132,9 +138,9 @@
132
138
 
133
139
  - Fix matchPath optional params matching without a "/" separator. ([#14689](https://github.com/remix-run/react-router/pull/14689))
134
140
  - matchPath("/users/:id?", "/usersblah") now returns null.
135
- - matchPath("/test\_route/:part?", "/test\_route\_more") now returns null.
141
+ - matchPath("/test_route/:part?", "/test_route_more") now returns null.
136
142
 
137
- - add RSC unstable\_getRequest ([#14758](https://github.com/remix-run/react-router/pull/14758))
143
+ - add RSC unstable_getRequest ([#14758](https://github.com/remix-run/react-router/pull/14758))
138
144
 
139
145
  - Fix `HydrateFallback` rendering during initial lazy route discovery with matching splat route ([#14740](https://github.com/remix-run/react-router/pull/14740))
140
146
 
@@ -180,7 +186,6 @@
180
186
  ```
181
187
 
182
188
  Notes:
183
-
184
189
  - The masked location, if present, will be available on `useLocation().unstable_mask` so you can detect whether you are currently masked or not.
185
190
  - Masked URLs only work for SPA use cases, and will be removed from `history.state` during SSR.
186
191
  - 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).
@@ -226,25 +231,25 @@
226
231
 
227
232
  | URL `/a/b/c` | **HTTP pathname** | **`request` pathname\`** |
228
233
  | ------------ | ----------------- | ------------------------ |
229
- | **Document** | `/a/b/c` | `/a/b/c` ✅ |
230
- | **Data** | `/a/b/c.data` | `/a/b/c` ✅ |
234
+ | **Document** | `/a/b/c` | `/a/b/c` ✅ |
235
+ | **Data** | `/a/b/c.data` | `/a/b/c` ✅ |
231
236
 
232
237
  | URL `/a/b/c/` | **HTTP pathname** | **`request` pathname\`** |
233
238
  | ------------- | ----------------- | ------------------------ |
234
- | **Document** | `/a/b/c/` | `/a/b/c/` ✅ |
239
+ | **Document** | `/a/b/c/` | `/a/b/c/` ✅ |
235
240
  | **Data** | `/a/b/c.data` | `/a/b/c` ⚠️ |
236
241
 
237
242
  With this flag enabled, these pathnames will be made consistent though a new `_.data` format for client-side `.data` requests:
238
243
 
239
244
  | URL `/a/b/c` | **HTTP pathname** | **`request` pathname\`** |
240
245
  | ------------ | ----------------- | ------------------------ |
241
- | **Document** | `/a/b/c` | `/a/b/c` ✅ |
242
- | **Data** | `/a/b/c.data` | `/a/b/c` ✅ |
246
+ | **Document** | `/a/b/c` | `/a/b/c` ✅ |
247
+ | **Data** | `/a/b/c.data` | `/a/b/c` ✅ |
243
248
 
244
249
  | URL `/a/b/c/` | **HTTP pathname** | **`request` pathname\`** |
245
250
  | ------------- | ------------------ | ------------------------ |
246
- | **Document** | `/a/b/c/` | `/a/b/c/` ✅ |
247
- | **Data** | `/a/b/c/_.data` ⬅️ | `/a/b/c/` ✅ |
251
+ | **Document** | `/a/b/c/` | `/a/b/c/` ✅ |
252
+ | **Data** | `/a/b/c/_.data` ⬅️ | `/a/b/c/` ✅ |
248
253
 
249
254
  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.
250
255
 
@@ -271,14 +276,12 @@
271
276
  - \[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))
272
277
 
273
278
  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.
274
-
275
279
  - `<Form method="post" unstable_defaultShouldRevalidate={false}>`
276
280
  - `submit(data, { method: "post", unstable_defaultShouldRevalidate: false })`
277
281
  - `<fetcher.Form method="post" unstable_defaultShouldRevalidate={false}>`
278
282
  - `fetcher.submit(data, { method: "post", unstable_defaultShouldRevalidate: false })`
279
283
 
280
284
  This is also available on non-submission APIs that may trigger revalidations due to changing search params:
281
-
282
285
  - `<Link to="/" unstable_defaultShouldRevalidate={false}>`
283
286
  - `navigate("/?foo=bar", { unstable_defaultShouldRevalidate: false })`
284
287
  - `setSearchParams(params, { unstable_defaultShouldRevalidate: false })`
@@ -301,7 +304,6 @@
301
304
  - ⚠️ This is a breaking change if you have begun using `fetcher.unstable_reset()`
302
305
 
303
306
  - Stabilize the `dataStrategy` `match.shouldRevalidateArgs`/`match.shouldCallHandler()` APIs. ([#14592](https://github.com/remix-run/react-router/pull/14592))
304
-
305
307
  - The `match.shouldLoad` API is now marked deprecated in favor of these more powerful alternatives
306
308
 
307
309
  - If you're using this API in a custom `dataStrategy` today, you can swap to the new API at your convenience:
@@ -430,7 +432,6 @@
430
432
  - Ensure action handlers run for routes with middleware even if no loader is present ([#14443](https://github.com/remix-run/react-router/pull/14443))
431
433
 
432
434
  - 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))
433
-
434
435
  - Framework Mode:
435
436
  - `entry.server.tsx`: `export const unstable_instrumentations = [...]`
436
437
  - `entry.client.tsx`: `<HydratedRouter unstable_instrumentations={[...]} />`
@@ -592,7 +593,6 @@
592
593
  - Stabilize middleware and context APIs. ([#14215](https://github.com/remix-run/react-router/pull/14215))
593
594
 
594
595
  We have removed the `unstable_` prefix from the following APIs and they are now considered stable and ready for production use:
595
-
596
596
  - [`RouterContextProvider`](https://reactrouter.com/api/utils/RouterContextProvider)
597
597
  - [`createContext`](https://reactrouter.com/api/utils/createContext)
598
598
  - `createBrowserRouter` [`getContext`](https://reactrouter.com/api/data-routers/createBrowserRouter#optsgetcontext) option
@@ -619,7 +619,7 @@
619
619
 
620
620
  - \[UNSTABLE] Add `<RouterProvider unstable_onError>`/`<HydratedRouter unstable_onError>` prop for client side error reporting ([#14162](https://github.com/remix-run/react-router/pull/14162))
621
621
 
622
- - server action revalidation opt out via $SKIP\_REVALIDATION field ([#14154](https://github.com/remix-run/react-router/pull/14154))
622
+ - server action revalidation opt out via $SKIP_REVALIDATION field ([#14154](https://github.com/remix-run/react-router/pull/14154))
623
623
 
624
624
  - Properly escape interpolated param values in `generatePath()` ([#13530](https://github.com/remix-run/react-router/pull/13530))
625
625
 
@@ -668,7 +668,6 @@
668
668
  - Remove dependency on `@types/node` in TypeScript declaration files ([#14059](https://github.com/remix-run/react-router/pull/14059))
669
669
 
670
670
  - Fix types for `UIMatch` to reflect that the `loaderData`/`data` properties may be `undefined` ([#12206](https://github.com/remix-run/react-router/pull/12206))
671
-
672
671
  - 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
673
672
  - 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
674
673
  - ⚠️ 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.
@@ -702,7 +701,6 @@
702
701
  - \[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))
703
702
 
704
703
  - \[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))
705
-
706
704
  - The API has been renamed to `unstable_generateMiddlewareResponse` for clarity
707
705
  - 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
708
706
  - The `query` version of the API now has a signature of `(query: (r: Request) => Promise<StaticHandlerContext | Response>) => Promise<Response>`
@@ -1348,7 +1346,6 @@
1348
1346
  ```
1349
1347
 
1350
1348
  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:
1351
-
1352
1349
  - Library mode - `createBrowserRouter(routes, { unstable_getContext })`
1353
1350
  - Framework mode - `<HydratedRouter unstable_getContext>`
1354
1351
 
@@ -1536,7 +1533,6 @@ _No changes_
1536
1533
  - Remove `future.v7_normalizeFormMethod` future flag ([#11697](https://github.com/remix-run/react-router/pull/11697))
1537
1534
 
1538
1535
  - 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))
1539
-
1540
1536
  - `createCookie`
1541
1537
  - `createCookieSessionStorage`
1542
1538
  - `createMemorySessionStorage`
@@ -1545,7 +1541,6 @@ _No changes_
1545
1541
  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)
1546
1542
 
1547
1543
  Since platform-specific packages no longer need to implement this API, the following low-level APIs have been removed:
1548
-
1549
1544
  - `createCookieFactory`
1550
1545
  - `createSessionStorageFactory`
1551
1546
  - `createCookieSessionStorageFactory`
@@ -1701,7 +1696,6 @@ _No changes_
1701
1696
  ```
1702
1697
 
1703
1698
  This initial implementation targets type inference for:
1704
-
1705
1699
  - `Params` : Path parameters from your routing config in `routes.ts` including file-based routing
1706
1700
  - `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
1707
1701
  - `ActionData` : Action data from `action` and/or `clientAction` within your route module
@@ -1716,7 +1710,6 @@ _No changes_
1716
1710
  ```
1717
1711
 
1718
1712
  Check out our docs for more:
1719
-
1720
1713
  - [_Explanations > Type Safety_](https://reactrouter.com/dev/guides/explanation/type-safety)
1721
1714
  - [_How-To > Setting up type safety_](https://reactrouter.com/dev/guides/how-to/setting-up-type-safety)
1722
1715
 
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { R as RouterInit } from './instrumentation-BYr6ff5D.js';
3
- 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 } from './routeModules-CA7kSxJJ.js';
2
+ import { R as RouterInit } from './instrumentation-CMVbvxj9.js';
3
+ 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 } from './routeModules-CM_clkdE.js';
4
4
 
5
5
  declare function getRequest(): Request;
6
6
  type RSCRouteConfigEntryBase = {
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { R as RouterInit } from './context-phCt_zmH.mjs';
3
- 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 } from './routeModules-BRrCYrSL.mjs';
2
+ import { R as RouterInit } from './context-BzhbVly6.mjs';
3
+ 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 } from './routeModules-Djumx26z.mjs';
4
4
 
5
5
  declare function getRequest(): Request;
6
6
  type RSCRouteConfigEntryBase = {