react-router 7.15.0 → 7.16.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 (72) hide show
  1. package/CHANGELOG.md +67 -10
  2. package/dist/development/{browser-wDl1FZEL.d.ts → browser-D3uq9sI1.d.ts} +2 -2
  3. package/dist/development/{browser-CRsXgNrY.d.mts → browser-nIQ4Nsyi.d.mts} +2 -2
  4. package/dist/development/{chunk-Z5YQYACE.js → chunk-IBI7OMNB.js} +107 -103
  5. package/dist/development/{chunk-5KNZJZUH.mjs → chunk-QUQL4437.mjs} +240 -122
  6. package/dist/development/{chunk-RMD3H4O3.mjs → chunk-S54KXAEJ.mjs} +26 -25
  7. package/dist/development/{chunk-AM3XM4LS.js → chunk-SRID2YZ2.js} +260 -146
  8. package/dist/{production/chunk-7YXKJMLN.js → development/chunk-XEJDWL2B.js} +7 -7
  9. package/dist/{production/context-BQs41HrG.d.mts → development/context-m8rizgnE.d.mts} +8 -2
  10. package/dist/development/{data-BqZ2x964.d.ts → data-D4xhSy90.d.ts} +1 -1
  11. package/dist/{production/data-BVUf681J.d.mts → development/data-U8FS-wNn.d.mts} +1 -1
  12. package/dist/development/dom-export.d.mts +3 -3
  13. package/dist/development/dom-export.d.ts +3 -3
  14. package/dist/development/dom-export.js +50 -52
  15. package/dist/development/dom-export.mjs +25 -27
  16. package/dist/{production/index-react-server-client-CSv-KZBk.d.ts → development/index-react-server-client-BLiUx67a.d.ts} +12 -4
  17. package/dist/{production/index-react-server-client-Ck_yZ1qL.d.mts → development/index-react-server-client-CdKROblb.d.mts} +12 -4
  18. package/dist/development/index-react-server-client.d.mts +3 -3
  19. package/dist/development/index-react-server-client.d.ts +3 -3
  20. package/dist/development/index-react-server-client.js +4 -4
  21. package/dist/development/index-react-server-client.mjs +2 -2
  22. package/dist/development/index-react-server.d.mts +7 -1
  23. package/dist/development/index-react-server.d.ts +7 -1
  24. package/dist/development/index-react-server.js +4 -4
  25. package/dist/development/index-react-server.mjs +4 -4
  26. package/dist/development/index.d.mts +100 -12
  27. package/dist/development/index.d.ts +100 -12
  28. package/dist/development/index.js +107 -104
  29. package/dist/development/index.mjs +5 -3
  30. package/dist/{production/instrumentation-DlJ2QV7d.d.ts → development/instrumentation-1q4YhLGP.d.ts} +8 -2
  31. package/dist/development/lib/types/internal.d.mts +2 -2
  32. package/dist/development/lib/types/internal.d.ts +2 -2
  33. package/dist/development/lib/types/internal.js +1 -1
  34. package/dist/development/lib/types/internal.mjs +1 -1
  35. package/dist/development/{register-Bsscfj79.d.ts → register-CNAx3TXj.d.ts} +1 -1
  36. package/dist/development/{register-Df8okEea.d.mts → register-CqK96Zfk.d.mts} +1 -1
  37. package/dist/production/{browser-wDl1FZEL.d.ts → browser-D3uq9sI1.d.ts} +2 -2
  38. package/dist/production/{browser-CRsXgNrY.d.mts → browser-nIQ4Nsyi.d.mts} +2 -2
  39. package/dist/{development/chunk-2D5H3HU3.js → production/chunk-EAQNHM3N.js} +7 -7
  40. package/dist/production/{chunk-23ZOHYE5.mjs → chunk-NALGHHKE.mjs} +26 -25
  41. package/dist/production/{chunk-GM3PW4GX.mjs → chunk-Q65P7S7Y.mjs} +240 -122
  42. package/dist/production/{chunk-YBQJ3ABE.js → chunk-SKEDDLRM.js} +107 -103
  43. package/dist/production/{chunk-LCJTIOKZ.js → chunk-Y7DNFQZP.js} +260 -146
  44. package/dist/{development/context-BQs41HrG.d.mts → production/context-m8rizgnE.d.mts} +8 -2
  45. package/dist/production/{data-BqZ2x964.d.ts → data-D4xhSy90.d.ts} +1 -1
  46. package/dist/{development/data-BVUf681J.d.mts → production/data-U8FS-wNn.d.mts} +1 -1
  47. package/dist/production/dom-export.d.mts +3 -3
  48. package/dist/production/dom-export.d.ts +3 -3
  49. package/dist/production/dom-export.js +50 -52
  50. package/dist/production/dom-export.mjs +25 -27
  51. package/dist/{development/index-react-server-client-CSv-KZBk.d.ts → production/index-react-server-client-BLiUx67a.d.ts} +12 -4
  52. package/dist/{development/index-react-server-client-Ck_yZ1qL.d.mts → production/index-react-server-client-CdKROblb.d.mts} +12 -4
  53. package/dist/production/index-react-server-client.d.mts +3 -3
  54. package/dist/production/index-react-server-client.d.ts +3 -3
  55. package/dist/production/index-react-server-client.js +4 -4
  56. package/dist/production/index-react-server-client.mjs +2 -2
  57. package/dist/production/index-react-server.d.mts +7 -1
  58. package/dist/production/index-react-server.d.ts +7 -1
  59. package/dist/production/index-react-server.js +4 -4
  60. package/dist/production/index-react-server.mjs +4 -4
  61. package/dist/production/index.d.mts +100 -12
  62. package/dist/production/index.d.ts +100 -12
  63. package/dist/production/index.js +107 -104
  64. package/dist/production/index.mjs +5 -3
  65. package/dist/{development/instrumentation-DlJ2QV7d.d.ts → production/instrumentation-1q4YhLGP.d.ts} +8 -2
  66. package/dist/production/lib/types/internal.d.mts +2 -2
  67. package/dist/production/lib/types/internal.d.ts +2 -2
  68. package/dist/production/lib/types/internal.js +1 -1
  69. package/dist/production/lib/types/internal.mjs +1 -1
  70. package/dist/production/{register-Bsscfj79.d.ts → register-CNAx3TXj.d.ts} +1 -1
  71. package/dist/production/{register-Df8okEea.d.mts → register-CqK96Zfk.d.mts} +1 -1
  72. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,40 +1,99 @@
1
1
  # `react-router`
2
2
 
3
+ ## v7.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Stabilize `future.unstable_trailingSlashAwareDataRequests` as `future.v8_trailingSlashAwareDataRequests` ([#15098](https://github.com/remix-run/react-router/pull/15098))
8
+
9
+ ### Patch Changes
10
+
11
+ - Disable manifest path when lazy route dicovery is disabled ([#15068](https://github.com/remix-run/react-router/pull/15068))
12
+
13
+ - Fix browser URL creation to use the configured history window instead of the global window. ([#15066](https://github.com/remix-run/react-router/pull/15066))
14
+
15
+ - Pass the history/router window through to `createBrowserURLImpl` so custom window contexts keep the correct URL origin.
16
+
17
+ - Fix `useNavigation()` return type to preserve discriminated union across navigation states ([#15095](https://github.com/remix-run/react-router/pull/15095))
18
+
19
+ - Widen `MetaDescriptor` `script:ld+json` type from `LdJsonObject` to `LdJsonObject | LdJsonObject[]` to permit multiple JSON-LD schemas in a single `<script type="application/ld+json">` tag emitted by `<Meta />` ([#15082](https://github.com/remix-run/react-router/pull/15082))
20
+
21
+ ## v7.15.1
22
+
23
+ ### Patch Changes
24
+
25
+ - Update router to operate on fetcher Maps in an immutable manner to avoid delayed React renders from potentially reading an updated but not yet committed Map. This could result in brief flickers in some fetcher-driven optimistic UI scenarios. ([#15028](https://github.com/remix-run/react-router/pull/15028))
26
+ - Fix `serverLoader()` returning stale SSR data when a client navigation aborts pending hydration before the hydration `clientLoader` resolves ([#15022](https://github.com/remix-run/react-router/pull/15022))
27
+ - Fix `RouterProvider` `onError` callback not being called for synchronous initial loader errors in SPA mode ([#15039](https://github.com/remix-run/react-router/pull/15039)) ([#14942](https://github.com/remix-run/react-router/pull/14942))
28
+ - Memoize `useFetchers` to return a stable identity and only change if fetchers changed ([#15028](https://github.com/remix-run/react-router/pull/15028))
29
+ - Internal refactor to consolidate mutation request detection through shared utility ([#15033](https://github.com/remix-run/react-router/pull/15033))
30
+
31
+ ### Unstable Changes
32
+
33
+ ⚠️ _[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use_
34
+
35
+ - Add a new `unstable_useRouterState()` hook that consolidates access to active and pending router states (RFC: #12358) ([#15017](https://github.com/remix-run/react-router/pull/15017))
36
+ - Data/Framework/RSC only — throws when used without a data router
37
+ - This should allow you to consolidate usages of the following hooks which will likely be deprecated and removed in a future major version
38
+ - `useLocation`
39
+ - `useSearchParams`
40
+ - `useParams`
41
+ - `useMatches`
42
+ - `useNavigationType`
43
+ - `useNavigation`
44
+
45
+ ```ts
46
+ let { active, pending } = unstable_useRouterState();
47
+
48
+ // Active is always populated with the current location
49
+ active.location; // replaces `useLocation()`
50
+ active.searchParams; // replaces `useSearchParams()[0]`
51
+ active.params; // replaces `useParams()`
52
+ active.matches; // replaces `useMatches()`
53
+ active.type; // replaces `useNavigationType()`
54
+
55
+ // Pending is only populated during a navigation
56
+ pending.location; // replaces `useNavigation().location`
57
+ pending.searchParams; // equivalent to `new URLSearchParams(useNavigation().search)`
58
+ pending.params; // Not directly accessible today
59
+ pending.matches; // Not directly accessible today
60
+ pending.type; // Not directly accessible today
61
+ pending.state; // replaces `useNavigation().state`
62
+ pending.formMethod; // replaces useNavigation().formMethod
63
+ pending.formAction; // replaces useNavigation().formAction
64
+ pending.formEncType; // replaces useNavigation().formEncType
65
+ pending.formData; // replaces useNavigation().formData
66
+ pending.json; // replaces useNavigation().json
67
+ pending.text; // replaces useNavigation().text
68
+ ```
69
+
3
70
  ## v7.15.0
4
71
 
5
72
  ### Minor Changes
6
73
 
7
74
  - Stabilize `unstable_defaultShouldRevalidate` as `defaultShouldRevalidate` on `<Link>`, `<Form>`, `useLinkClickHandler`, `useSubmit`, `fetcher.submit`, and `setSearchParams` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
8
-
9
75
  - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
10
76
 
11
77
  - Stabilize the instrumentation APIs. `unstable_instrumentations` is now `instrumentations` and `unstable_pattern` is now `pattern` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
12
-
13
78
  - The `unstable_ServerInstrumentation`, `unstable_ClientInstrumentation`, `unstable_InstrumentRequestHandlerFunction`, `unstable_InstrumentRouterFunction`, `unstable_InstrumentRouteFunction`, and `unstable_InstrumentationHandlerResult` types have had their `unstable_` prefixes removed
14
79
  - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
15
80
 
16
81
  - Stabilize `unstable_mask` as `mask` on `<Link>`, `useLinkClickHandler`, and `useNavigate`, and rename the corresponding `Location.unstable_mask` field to `Location.mask` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
17
-
18
82
  - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
19
83
 
20
84
  - Stabilize the `unstable_normalizePath` option on `staticHandler.query` and `staticHandler.queryRoute` as `normalizePath` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
21
-
22
85
  - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
23
86
 
24
87
  - Stabilize `future.unstable_passThroughRequests` as `future.v8_passThroughRequests` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
25
-
26
88
  - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
27
89
 
28
90
  - Remove `unstable_subResourceIntegrity` from the runtime `FutureConfig` type; the flag is now controlled by the top-level `subResourceIntegrity` option in `react-router.config.ts` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
29
-
30
91
  - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
31
92
 
32
93
  - Stabilize `unstable_url` as `url` on `loader`, `action`, and `middleware` function args ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
33
-
34
94
  - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
35
95
 
36
96
  - Stabilize `unstable_useTransitions` as `useTransitions` on `<BrowserRouter>`, `<HashRouter>`, `<HistoryRouter>`, `<MemoryRouter>`, `<Router>`, `<RouterProvider>`, `<HydratedRouter>`, and `useLinkClickHandler` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
37
-
38
97
  - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
39
98
 
40
99
  ### Patch Changes
@@ -44,7 +103,6 @@
44
103
  - Fix a bug with `unstable_defaultShouldRevalidate={false}` where parent routes that did not export a `shouldRevalidate` function could be incorrectly included in the single fetch call for new child route data ([#15012](https://github.com/remix-run/react-router/pull/15012))
45
104
 
46
105
  - Improve server-side route matching performance by pre-computing flattened/cached route branches ([#14967](https://github.com/remix-run/react-router/pull/14967)) ([af5d49b](https://github.com/remix-run/react-router/commit/af5d49b))
47
-
48
106
  - Performance benchmarks showed roughly a 10-15% improvement in server-side request handling performance
49
107
 
50
108
  - Mark `mask` as an optional field in `Location` for easier mocking in unit tests ([#14999](https://github.com/remix-run/react-router/pull/14999))
@@ -52,7 +110,6 @@
52
110
  - Cache flattened/ranked route branches to optimize server-side route matching ([#14967](https://github.com/remix-run/react-router/pull/14967))
53
111
 
54
112
  - Improve route matching performance in Framework/Data Mode ([#14971](https://github.com/remix-run/react-router/pull/14971)) ([af5d49b](https://github.com/remix-run/react-router/commit/af5d49b))
55
-
56
113
  - Avoiding unnecessary calls to `matchRoutes` in data router scenarios
57
114
  - This includes adding back the optimization that was removed in `7.6.0` ([#13562](https://github.com/remix-run/react-router/pull/13562))
58
115
  - The issues that prompted the revert have been addressed by using the available router `matches` but always updating `match.route` to the latest route in the `manifest`
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { R as RouterInit } from './instrumentation-DlJ2QV7d.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 './data-BqZ2x964.js';
2
+ import { R as RouterInit } from './instrumentation-1q4YhLGP.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 './data-D4xhSy90.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-BQs41HrG.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 './data-BVUf681J.mjs';
2
+ import { R as RouterInit } from './context-m8rizgnE.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 './data-U8FS-wNn.mjs';
4
4
 
5
5
  declare function getRequest(): Request;
6
6
  type RSCRouteConfigEntryBase = {