react-router 7.0.0-pre.5 → 7.0.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 +98 -184
- package/dist/{chunk-ICGFMBUV.mjs → development/chunk-U6WQEHBI.mjs} +4 -3
- package/dist/development/data-CQbyyGzl.d.mts +11 -0
- package/dist/development/data-CQbyyGzl.d.ts +11 -0
- package/dist/development/dom-export.d.mts +13 -0
- package/dist/{dom-export.d.ts → development/dom-export.d.ts} +2 -2
- package/dist/{dom-export.js → development/dom-export.js} +1 -1
- package/dist/{dom-export.mjs → development/dom-export.mjs} +2 -2
- package/dist/development/fog-of-war-BDQTYoRQ.d.mts +1595 -0
- package/dist/{fog-of-war-BijhfqFM.d.ts → development/fog-of-war-CbNQuoo8.d.ts} +2 -2
- package/dist/development/index.d.mts +840 -0
- package/dist/{index.d.ts → development/index.d.ts} +6 -5
- package/dist/{index.js → development/index.js} +4 -3
- package/dist/{index.mjs → development/index.mjs} +2 -2
- package/dist/development/lib/types/route-module.d.mts +102 -0
- package/dist/development/lib/types/route-module.d.ts +102 -0
- package/dist/{lib/types.js → development/lib/types/route-module.js} +4 -4
- package/dist/{lib/types.mjs → development/lib/types/route-module.mjs} +1 -1
- package/dist/{types-BlYP8xpH.d.mts → development/route-data-DuV3tXo2.d.mts} +20 -94
- package/dist/{types-BlYP8xpH.d.ts → development/route-data-DuV3tXo2.d.ts} +20 -94
- package/dist/production/chunk-L6MGG5FJ.mjs +9618 -0
- package/dist/production/data-CQbyyGzl.d.mts +11 -0
- package/dist/production/data-CQbyyGzl.d.ts +11 -0
- package/dist/production/dom-export.d.mts +13 -0
- package/dist/{dom-export.d.mts → production/dom-export.d.ts} +2 -2
- package/dist/production/dom-export.js +5502 -0
- package/dist/production/dom-export.mjs +199 -0
- package/dist/production/fog-of-war-BDQTYoRQ.d.mts +1595 -0
- package/dist/{fog-of-war-Bz_EDtxF.d.mts → production/fog-of-war-CbNQuoo8.d.ts} +2 -2
- package/dist/production/index.d.mts +840 -0
- package/dist/{index.d.mts → production/index.d.ts} +6 -5
- package/dist/production/index.js +9764 -0
- package/dist/production/index.mjs +235 -0
- package/dist/production/lib/types/route-module.d.mts +102 -0
- package/dist/production/lib/types/route-module.d.ts +102 -0
- package/dist/production/lib/types/route-module.js +28 -0
- package/dist/production/lib/types/route-module.mjs +10 -0
- package/dist/production/route-data-DuV3tXo2.d.mts +1546 -0
- package/dist/production/route-data-DuV3tXo2.d.ts +1546 -0
- package/package.json +37 -23
- package/dist/lib/types.d.mts +0 -2
- package/dist/lib/types.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,68 +1,6 @@
|
|
|
1
1
|
# `react-router`
|
|
2
2
|
|
|
3
|
-
## 7.0.0
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- No changes ([`506329c4e`](https://github.com/remix-run/react-router/commit/506329c4e2e7aba9837cbfa44df6103b49423745))
|
|
8
|
-
|
|
9
|
-
## 7.0.0-pre.4
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- [REMOVE] Changeset to bump pre.4 release ([`8a5cf097f`](https://github.com/remix-run/react-router/commit/8a5cf097f98f12e32d42e85ecd87523b72a85195))
|
|
14
|
-
|
|
15
|
-
## 7.0.0-pre.3
|
|
16
|
-
|
|
17
|
-
## 7.0.0-pre.2
|
|
18
|
-
|
|
19
|
-
### Major Changes
|
|
20
|
-
|
|
21
|
-
- Migrate Remix type generics to React Router ([#12180](https://github.com/remix-run/react-router/pull/12180))
|
|
22
|
-
|
|
23
|
-
- These generics are provided for Remix v2 migration purposes
|
|
24
|
-
- These generics and the APIs they exist on should be considered informally deprecated in favor of the new `Route.*` types
|
|
25
|
-
- Anyone migrating from React Router v6 should probably not leverage these new generics and should migrate straight to the `Route.*` types
|
|
26
|
-
- For React Router v6 users, these generics are new and should not impact your app, with one exception
|
|
27
|
-
- `useFetcher` previously had an optional generic (used primarily by Remix v2) that expected the data type
|
|
28
|
-
- This has been updated in v7 to expect the type of the function that generates the data (i.e., `typeof loader`/`typeof action`)
|
|
29
|
-
- Therefore, you should update your usages:
|
|
30
|
-
- ❌ `useFetcher<LoaderData>()`
|
|
31
|
-
- ✅ `useFetcher<typeof loader>()`
|
|
32
|
-
|
|
33
|
-
- - Consolidate types previously duplicated across `@remix-run/router`, `@remix-run/server-runtime`, and `@remix-run/react` now that they all live in `react-router` ([#12177](https://github.com/remix-run/react-router/pull/12177))
|
|
34
|
-
- Examples: `LoaderFunction`, `LoaderFunctionArgs`, `ActionFunction`, `ActionFunctionArgs`, `DataFunctionArgs`, `RouteManifest`, `LinksFunction`, `Route`, `EntryRoute`
|
|
35
|
-
- The `RouteManifest` type used by the "remix" code is now slightly stricter because it is using the former `@remix-run/router` `RouteManifest`
|
|
36
|
-
- `Record<string, Route> -> Record<string, Route | undefined>`
|
|
37
|
-
- Removed `AppData` type in favor of inlining `unknown` in the few locations it was used
|
|
38
|
-
- Removed `ServerRuntimeMeta*` types in favor of the `Meta*` types they were duplicated from
|
|
39
|
-
- Drop support for Node 18, update minimum Node vestion to 20 ([#12171](https://github.com/remix-run/react-router/pull/12171))
|
|
40
|
-
|
|
41
|
-
- Remove `installGlobals()` as this should no longer be necessary
|
|
42
|
-
|
|
43
|
-
- Update `cookie` dependency to `^1.0.1` - please see the [release notes](https://github.com/jshttp/cookie/releases) for any breaking changes ([#12172](https://github.com/remix-run/react-router/pull/12172))
|
|
44
|
-
|
|
45
|
-
### Patch Changes
|
|
46
|
-
|
|
47
|
-
- Replace `substr` with `substring` ([#12080](https://github.com/remix-run/react-router/pull/12080))
|
|
48
|
-
- Remove the deprecated `json` utility ([#12146](https://github.com/remix-run/react-router/pull/12146))
|
|
49
|
-
|
|
50
|
-
- You can use [`Response.json`](https://developer.mozilla.org/en-US/docs/Web/API/Response/json_static) if you still need to construct JSON responses in your app
|
|
51
|
-
|
|
52
|
-
- Updated dependencies:
|
|
53
|
-
- `react-router@7.0.0-pre.2`
|
|
54
|
-
|
|
55
|
-
## 7.0.0-pre.1
|
|
56
|
-
|
|
57
|
-
### Patch Changes
|
|
58
|
-
|
|
59
|
-
- Fix typegen for routes with a client loader but no server loader ([#12117](https://github.com/remix-run/react-router/pull/12117))
|
|
60
|
-
- - Fix `react-router-serve` handling of prerendered HTML files by removing the `redirect: false` option so it now falls back on the default `redirect: true` behavior of redirecting from `/folder` -> `/folder/` which will then pick up `/folder/index.html` from disk. See https://expressjs.com/en/resources/middleware/serve-static.html ([#12071](https://github.com/remix-run/react-router/pull/12071))
|
|
61
|
-
- Proxy prerendered loader data into prerender pass for HTML files to avoid double-invocations of the loader at build time
|
|
62
|
-
- Updated dependencies:
|
|
63
|
-
- `react-router@7.0.0-pre.1`
|
|
64
|
-
|
|
65
|
-
## 7.0.0-pre.0
|
|
3
|
+
## 7.0.0
|
|
66
4
|
|
|
67
5
|
### Major Changes
|
|
68
6
|
|
|
@@ -78,16 +16,22 @@
|
|
|
78
16
|
- Collapse `react-router-dom` into `react-router`
|
|
79
17
|
- Collapse `@remix-run/server-runtime` into `react-router`
|
|
80
18
|
- Collapse `@remix-run/testing` into `react-router`
|
|
19
|
+
|
|
81
20
|
- Remove single_fetch future flag. ([#11522](https://github.com/remix-run/react-router/pull/11522))
|
|
21
|
+
|
|
82
22
|
- Drop support for Node 16, React Router SSR now requires Node 18 or higher ([#11391](https://github.com/remix-run/react-router/pull/11391))
|
|
23
|
+
|
|
83
24
|
- Remove `future.v7_startTransition` flag ([#11696](https://github.com/remix-run/react-router/pull/11696))
|
|
25
|
+
|
|
84
26
|
- - Expose the underlying router promises from the following APIs for compsition in React 19 APIs: ([#11521](https://github.com/remix-run/react-router/pull/11521))
|
|
85
27
|
- `useNavigate()`
|
|
86
28
|
- `useSubmit`
|
|
87
29
|
- `useFetcher().load`
|
|
88
30
|
- `useFetcher().submit`
|
|
89
31
|
- `useRevalidator.revalidate`
|
|
32
|
+
|
|
90
33
|
- Remove `future.v7_normalizeFormMethod` future flag ([#11697](https://github.com/remix-run/react-router/pull/11697))
|
|
34
|
+
|
|
91
35
|
- 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))
|
|
92
36
|
|
|
93
37
|
- `createCookie`
|
|
@@ -138,27 +82,62 @@
|
|
|
138
82
|
- `Search`
|
|
139
83
|
|
|
140
84
|
- update minimum node version to 18 ([#11690](https://github.com/remix-run/react-router/pull/11690))
|
|
85
|
+
|
|
141
86
|
- Remove `future.v7_prependBasename` from the ionternalized `@remix-run/router` package ([#11726](https://github.com/remix-run/react-router/pull/11726))
|
|
87
|
+
|
|
88
|
+
- Migrate Remix type generics to React Router ([#12180](https://github.com/remix-run/react-router/pull/12180))
|
|
89
|
+
|
|
90
|
+
- These generics are provided for Remix v2 migration purposes
|
|
91
|
+
- These generics and the APIs they exist on should be considered informally deprecated in favor of the new `Route.*` types
|
|
92
|
+
- Anyone migrating from React Router v6 should probably not leverage these new generics and should migrate straight to the `Route.*` types
|
|
93
|
+
- For React Router v6 users, these generics are new and should not impact your app, with one exception
|
|
94
|
+
- `useFetcher` previously had an optional generic (used primarily by Remix v2) that expected the data type
|
|
95
|
+
- This has been updated in v7 to expect the type of the function that generates the data (i.e., `typeof loader`/`typeof action`)
|
|
96
|
+
- Therefore, you should update your usages:
|
|
97
|
+
- ❌ `useFetcher<LoaderData>()`
|
|
98
|
+
- ✅ `useFetcher<typeof loader>()`
|
|
99
|
+
|
|
142
100
|
- Remove `future.v7_throwAbortReason` from internalized `@remix-run/router` package ([#11728](https://github.com/remix-run/react-router/pull/11728))
|
|
101
|
+
|
|
143
102
|
- Add `exports` field to all packages ([#11675](https://github.com/remix-run/react-router/pull/11675))
|
|
103
|
+
|
|
144
104
|
- node package no longer re-exports from react-router ([#11702](https://github.com/remix-run/react-router/pull/11702))
|
|
105
|
+
|
|
145
106
|
- renamed RemixContext to FrameworkContext ([#11705](https://github.com/remix-run/react-router/pull/11705))
|
|
107
|
+
|
|
146
108
|
- updates the minimum React version to 18 ([#11689](https://github.com/remix-run/react-router/pull/11689))
|
|
109
|
+
|
|
147
110
|
- PrefetchPageDescriptor replaced by PageLinkDescriptor ([#11960](https://github.com/remix-run/react-router/pull/11960))
|
|
111
|
+
|
|
112
|
+
- - Consolidate types previously duplicated across `@remix-run/router`, `@remix-run/server-runtime`, and `@remix-run/react` now that they all live in `react-router` ([#12177](https://github.com/remix-run/react-router/pull/12177))
|
|
113
|
+
- Examples: `LoaderFunction`, `LoaderFunctionArgs`, `ActionFunction`, `ActionFunctionArgs`, `DataFunctionArgs`, `RouteManifest`, `LinksFunction`, `Route`, `EntryRoute`
|
|
114
|
+
- The `RouteManifest` type used by the "remix" code is now slightly stricter because it is using the former `@remix-run/router` `RouteManifest`
|
|
115
|
+
- `Record<string, Route> -> Record<string, Route | undefined>`
|
|
116
|
+
- Removed `AppData` type in favor of inlining `unknown` in the few locations it was used
|
|
117
|
+
- Removed `ServerRuntimeMeta*` types in favor of the `Meta*` types they were duplicated from
|
|
118
|
+
|
|
148
119
|
- - Remove the `future.v7_partialHydration` flag ([#11725](https://github.com/remix-run/react-router/pull/11725))
|
|
149
120
|
- This also removes the `<RouterProvider fallbackElement>` prop
|
|
150
121
|
- To migrate, move the `fallbackElement` to a `hydrateFallbackElement`/`HydrateFallback` on your root route
|
|
151
122
|
- Also worth nothing there is a related breaking changer with this future flag:
|
|
152
123
|
- Without `future.v7_partialHydration` (when using `fallbackElement`), `state.navigation` was populated during the initial load
|
|
153
124
|
- With `future.v7_partialHydration`, `state.navigation` remains in an `"idle"` state during the initial load
|
|
125
|
+
|
|
154
126
|
- Remove `v7_relativeSplatPath` future flag ([#11695](https://github.com/remix-run/react-router/pull/11695))
|
|
127
|
+
|
|
128
|
+
- Drop support for Node 18, update minimum Node vestion to 20 ([#12171](https://github.com/remix-run/react-router/pull/12171))
|
|
129
|
+
|
|
130
|
+
- Remove `installGlobals()` as this should no longer be necessary
|
|
131
|
+
|
|
155
132
|
- Remove remaining future flags ([#11820](https://github.com/remix-run/react-router/pull/11820))
|
|
156
133
|
|
|
157
134
|
- React Router `v7_skipActionErrorRevalidation`
|
|
158
135
|
- Remix `v3_fetcherPersist`, `v3_relativeSplatPath`, `v3_throwAbortReason`
|
|
159
136
|
|
|
160
137
|
- rename createRemixStub to createRoutesStub ([#11692](https://github.com/remix-run/react-router/pull/11692))
|
|
138
|
+
|
|
161
139
|
- Remove `@remix-run/router` deprecated `detectErrorBoundary` option in favor of `mapRouteProperties` ([#11751](https://github.com/remix-run/react-router/pull/11751))
|
|
140
|
+
|
|
162
141
|
- Add `react-router/dom` subpath export to properly enable `react-dom` as an optional `peerDependency` ([#11851](https://github.com/remix-run/react-router/pull/11851))
|
|
163
142
|
|
|
164
143
|
- This ensures that we don't blindly `import ReactDOM from "react-dom"` in `<RouterProvider>` in order to access `ReactDOM.flushSync()`, since that would break `createMemoryRouter` use cases in non-DOM environments
|
|
@@ -170,6 +149,8 @@
|
|
|
170
149
|
|
|
171
150
|
- Remove `future.v7_fetcherPersist` flag ([#11731](https://github.com/remix-run/react-router/pull/11731))
|
|
172
151
|
|
|
152
|
+
- Update `cookie` dependency to `^1.0.1` - please see the [release notes](https://github.com/jshttp/cookie/releases) for any breaking changes ([#12172](https://github.com/remix-run/react-router/pull/12172))
|
|
153
|
+
|
|
173
154
|
### Minor Changes
|
|
174
155
|
|
|
175
156
|
- - Add support for `prerender` config in the React Router vite plugin, to support existing SSG use-cases ([#11539](https://github.com/remix-run/react-router/pull/11539))
|
|
@@ -177,19 +158,17 @@
|
|
|
177
158
|
- `prerender` can either be an array of string paths, or a function (sync or async) that returns an array of strings so that you can dynamically generate the paths by talking to your CMS, etc.
|
|
178
159
|
|
|
179
160
|
```ts
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
],
|
|
192
|
-
});
|
|
161
|
+
// react-router.config.ts
|
|
162
|
+
import type { Config } from "@react-router/dev/config";
|
|
163
|
+
|
|
164
|
+
export default {
|
|
165
|
+
async prerender() {
|
|
166
|
+
let slugs = await fakeGetSlugsFromCms();
|
|
167
|
+
// Prerender these paths into `.html` files at build time, and `.data`
|
|
168
|
+
// files if they have loaders
|
|
169
|
+
return ["/", "/about", ...slugs.map((slug) => `/product/${slug}`)];
|
|
170
|
+
},
|
|
171
|
+
} satisfies Config;
|
|
193
172
|
|
|
194
173
|
async function fakeGetSlugsFromCms() {
|
|
195
174
|
await new Promise((r) => setTimeout(r, 1000));
|
|
@@ -197,10 +176,6 @@
|
|
|
197
176
|
}
|
|
198
177
|
```
|
|
199
178
|
|
|
200
|
-
- [REMOVE] Allow returning undefined from loaders/actions part 2 ([#12057](https://github.com/remix-run/react-router/pull/12057))
|
|
201
|
-
|
|
202
|
-
- This is a follow up to #11680 which missed some of the Remix codepaths
|
|
203
|
-
|
|
204
179
|
- Params, loader data, and action data as props for route component exports ([#11961](https://github.com/remix-run/react-router/pull/11961))
|
|
205
180
|
|
|
206
181
|
```tsx
|
|
@@ -211,6 +186,7 @@
|
|
|
211
186
|
```
|
|
212
187
|
|
|
213
188
|
- Remove duplicate `RouterProvider` impliementations ([#11679](https://github.com/remix-run/react-router/pull/11679))
|
|
189
|
+
|
|
214
190
|
- ### Typesafety improvements ([#12019](https://github.com/remix-run/react-router/pull/12019))
|
|
215
191
|
|
|
216
192
|
React Router now generates types for each of your route modules.
|
|
@@ -232,16 +208,6 @@
|
|
|
232
208
|
- `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
|
|
233
209
|
- `ActionData` : Action data from `action` and/or `clientAction` within your route module
|
|
234
210
|
|
|
235
|
-
These types are then used to create types for route export args and props:
|
|
236
|
-
|
|
237
|
-
- `LoaderArgs`
|
|
238
|
-
- `ClientLoaderArgs`
|
|
239
|
-
- `ActionArgs`
|
|
240
|
-
- `ClientActionArgs`
|
|
241
|
-
- `HydrateFallbackProps`
|
|
242
|
-
- `ComponentProps` (for the `default` export)
|
|
243
|
-
- `ErrorBoundaryProps`
|
|
244
|
-
|
|
245
211
|
In the future, we plan to add types for the rest of the route module exports: `meta`, `links`, `headers`, `shouldRevalidate`, etc.
|
|
246
212
|
We also plan to generate types for typesafe `Link`s:
|
|
247
213
|
|
|
@@ -251,123 +217,71 @@
|
|
|
251
217
|
// typesafe `to` and `params` based on the available routes in your app
|
|
252
218
|
```
|
|
253
219
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
React Router will generate types into a `.react-router/` directory at the root of your app.
|
|
257
|
-
This directory is fully managed by React Router and is derived based on your route config (`routes.ts`).
|
|
258
|
-
|
|
259
|
-
👉 **Add `.react-router/` to `.gitignore`**
|
|
260
|
-
|
|
261
|
-
```txt
|
|
262
|
-
.react-router
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
You should also ensure that generated types for routes are always present before running typechecking,
|
|
266
|
-
especially for running typechecking in CI.
|
|
220
|
+
Check out our docs for more:
|
|
267
221
|
|
|
268
|
-
|
|
222
|
+
- [_Explanations > Type Safety_](https://reactrouter.com/dev/guides/explanation/type-safety)
|
|
223
|
+
- [_How-To > Setting up type safety_](https://reactrouter.com/dev/guides/how-to/setting-up-type-safety)
|
|
269
224
|
|
|
270
|
-
|
|
271
|
-
{
|
|
272
|
-
"scripts": {
|
|
273
|
-
"typecheck": "react-router typegen && tsc"
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
To get TypeScript to use those generated types, you'll need to add them to `include` in `tsconfig.json`.
|
|
279
|
-
And to be able to import them as if they files next to your route modules, you'll also need to configure `rootDirs`.
|
|
280
|
-
|
|
281
|
-
👉 **Configure `tsconfig.json` for generated types**
|
|
225
|
+
- Stabilize `unstable_dataStrategy` ([#11969](https://github.com/remix-run/react-router/pull/11969))
|
|
282
226
|
|
|
283
|
-
|
|
284
|
-
{
|
|
285
|
-
"include": [".react-router/types/**/*"],
|
|
286
|
-
"compilerOptions": {
|
|
287
|
-
"rootDirs": [".", "./.react-router/types"]
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
```
|
|
227
|
+
- Stabilize `unstable_patchRoutesOnNavigation` ([#11970](https://github.com/remix-run/react-router/pull/11970))
|
|
291
228
|
|
|
292
|
-
|
|
229
|
+
### Patch Changes
|
|
293
230
|
|
|
294
|
-
|
|
231
|
+
- No changes ([`506329c4e`](https://github.com/remix-run/react-router/commit/506329c4e2e7aba9837cbfa44df6103b49423745))
|
|
295
232
|
|
|
296
|
-
|
|
297
|
-
react-router typegen
|
|
298
|
-
```
|
|
233
|
+
- chore: re-enable development warnings through a `development` exports condition. ([#12269](https://github.com/remix-run/react-router/pull/12269))
|
|
299
234
|
|
|
300
|
-
|
|
301
|
-
Instead, we recommend that you setup our new TypeScript plugin which will automatically generate fresh types whenever routes change.
|
|
302
|
-
That way, you'll always have up-to-date types.
|
|
235
|
+
- Remove unstable upload handler. ([#12015](https://github.com/remix-run/react-router/pull/12015))
|
|
303
236
|
|
|
304
|
-
|
|
237
|
+
- Remove unneeded dependency on @web3-storage/multipart-parser ([#12274](https://github.com/remix-run/react-router/pull/12274))
|
|
305
238
|
|
|
306
|
-
|
|
239
|
+
- Fix redirects returned from loaders/actions using `data()` ([#12021](https://github.com/remix-run/react-router/pull/12021))
|
|
307
240
|
|
|
308
|
-
|
|
241
|
+
- fix(react-router): (v7) fix static prerender of non-ascii characters ([#12161](https://github.com/remix-run/react-router/pull/12161))
|
|
309
242
|
|
|
310
|
-
|
|
311
|
-
{
|
|
312
|
-
"compilerOptions": {
|
|
313
|
-
"plugins": [{ "name": "@react-router/dev" }]
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
```
|
|
243
|
+
- Replace `substr` with `substring` ([#12080](https://github.com/remix-run/react-router/pull/12080))
|
|
317
244
|
|
|
318
|
-
|
|
245
|
+
- Remove the deprecated `json` utility ([#12146](https://github.com/remix-run/react-router/pull/12146))
|
|
319
246
|
|
|
320
|
-
-
|
|
321
|
-
- Autocomplete for route exports
|
|
322
|
-
- Warnings for non-HMR compliant exports
|
|
247
|
+
- You can use [`Response.json`](https://developer.mozilla.org/en-US/docs/Web/API/Response/json_static) if you still need to construct JSON responses in your app
|
|
323
248
|
|
|
324
|
-
|
|
249
|
+
- Remove unneeded dependency on source-map ([#12275](https://github.com/remix-run/react-router/pull/12275))
|
|
325
250
|
|
|
326
|
-
|
|
327
|
-
but VSCode ships with its own copy of TypeScript that is installed outside of your project.
|
|
328
|
-
For TypeScript plugins to work, you'll need to tell VSCode to use the local workspace version of TypeScript.
|
|
329
|
-
For security reasons, [VSCode won't use the workspace version of TypeScript](https://code.visualstudio.com/docs/typescript/typescript-compiling#_using-the-workspace-version-of-typescript) until you manually opt-in.
|
|
251
|
+
## 6.28.0
|
|
330
252
|
|
|
331
|
-
|
|
253
|
+
### Minor Changes
|
|
332
254
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
"typescript.enablePromptUseWorkspaceTsdk": true
|
|
337
|
-
}
|
|
338
|
-
```
|
|
255
|
+
- - Log deprecation warnings for v7 flags ([#11750](https://github.com/remix-run/react-router/pull/11750))
|
|
256
|
+
- Add deprecation warnings to `json`/`defer` in favor of returning raw objects
|
|
257
|
+
- These methods will be removed in React Router v7
|
|
339
258
|
|
|
340
|
-
|
|
259
|
+
### Patch Changes
|
|
341
260
|
|
|
342
|
-
|
|
343
|
-
|
|
261
|
+
- Update JSDoc URLs for new website structure (add /v6/ segment) ([#12141](https://github.com/remix-run/react-router/pull/12141))
|
|
262
|
+
- Updated dependencies:
|
|
263
|
+
- `@remix-run/router@1.21.0`
|
|
344
264
|
|
|
345
|
-
|
|
265
|
+
## 6.27.0
|
|
346
266
|
|
|
347
|
-
|
|
267
|
+
### Minor Changes
|
|
348
268
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
269
|
+
- Stabilize `unstable_patchRoutesOnNavigation` ([#11973](https://github.com/remix-run/react-router/pull/11973))
|
|
270
|
+
- Add new `PatchRoutesOnNavigationFunctionArgs` type for convenience ([#11967](https://github.com/remix-run/react-router/pull/11967))
|
|
271
|
+
- Stabilize `unstable_dataStrategy` ([#11974](https://github.com/remix-run/react-router/pull/11974))
|
|
272
|
+
- Stabilize the `unstable_flushSync` option for navigations and fetchers ([#11989](https://github.com/remix-run/react-router/pull/11989))
|
|
273
|
+
- Stabilize the `unstable_viewTransition` option for navigations and the corresponding `unstable_useViewTransitionState` hook ([#11989](https://github.com/remix-run/react-router/pull/11989))
|
|
354
274
|
|
|
355
|
-
|
|
275
|
+
### Patch Changes
|
|
356
276
|
|
|
357
|
-
|
|
358
|
-
There should be a log for `[react-router] setup` that indicates that the plugin was resolved correctly.
|
|
359
|
-
Then look for any errors in the log.
|
|
277
|
+
- Fix bug when submitting to the current contextual route (parent route with an index child) when an `?index` param already exists from a prior submission ([#12003](https://github.com/remix-run/react-router/pull/12003))
|
|
360
278
|
|
|
361
|
-
-
|
|
362
|
-
- Stabilize `unstable_patchRoutesOnNavigation` ([#11970](https://github.com/remix-run/react-router/pull/11970))
|
|
279
|
+
- Fix `useFormAction` bug - when removing `?index` param it would not keep other non-Remix `index` params ([#12003](https://github.com/remix-run/react-router/pull/12003))
|
|
363
280
|
|
|
364
|
-
|
|
281
|
+
- Fix types for `RouteObject` within `PatchRoutesOnNavigationFunction`'s `patch` method so it doesn't expect agnostic route objects passed to `patch` ([#11967](https://github.com/remix-run/react-router/pull/11967))
|
|
365
282
|
|
|
366
|
-
- Remove unstable upload handler. ([#12015](https://github.com/remix-run/react-router/pull/12015))
|
|
367
|
-
- Fix redirects returned from loaders/actions using `data()` ([#12021](https://github.com/remix-run/react-router/pull/12021))
|
|
368
|
-
- [REMOVE] Rename RemixRouter->DataRouter ([#12062](https://github.com/remix-run/react-router/pull/12062))
|
|
369
283
|
- Updated dependencies:
|
|
370
|
-
-
|
|
284
|
+
- `@remix-run/router@1.20.0`
|
|
371
285
|
|
|
372
286
|
## 6.26.2
|
|
373
287
|
|
|
@@ -430,7 +344,7 @@ No significant changes to this package were made in this release. [See the repo
|
|
|
430
344
|
|
|
431
345
|
- Add support for Lazy Route Discovery (a.k.a. Fog of War) ([#11626](https://github.com/remix-run/react-router/pull/11626))
|
|
432
346
|
- RFC: <https://github.com/remix-run/react-router/discussions/11113>
|
|
433
|
-
- `unstable_patchRoutesOnMiss` docs: <https://reactrouter.com/
|
|
347
|
+
- `unstable_patchRoutesOnMiss` docs: <https://reactrouter.com/v6/routers/create-browser-router>
|
|
434
348
|
|
|
435
349
|
### Patch Changes
|
|
436
350
|
|
|
@@ -676,7 +590,7 @@ No significant changes to this package were made in this release. [See the repo
|
|
|
676
590
|
### Minor Changes
|
|
677
591
|
|
|
678
592
|
- Add `unstable_flushSync` option to `useNavigate`/`useSumbit`/`fetcher.load`/`fetcher.submit` to opt-out of `React.startTransition` and into `ReactDOM.flushSync` for state updates ([#11005](https://github.com/remix-run/react-router/pull/11005))
|
|
679
|
-
- Remove the `unstable_` prefix from the [`useBlocker`](https://reactrouter.com/
|
|
593
|
+
- Remove the `unstable_` prefix from the [`useBlocker`](https://reactrouter.com/v6/hooks/use-blocker) hook as it's been in use for enough time that we are confident in the API. We do not plan to remove the prefix from `unstable_usePrompt` due to differences in how browsers handle `window.confirm` that prevent React Router from guaranteeing consistent/correct behavior. ([#10991](https://github.com/remix-run/react-router/pull/10991))
|
|
680
594
|
|
|
681
595
|
### Patch Changes
|
|
682
596
|
|
|
@@ -766,7 +680,7 @@ No significant changes to this package were made in this release. [See the repo
|
|
|
766
680
|
|
|
767
681
|
### Minor Changes
|
|
768
682
|
|
|
769
|
-
- Move [`React.startTransition`](https://react.dev/reference/react/startTransition) usage behind a [future flag](https://reactrouter.com/
|
|
683
|
+
- Move [`React.startTransition`](https://react.dev/reference/react/startTransition) usage behind a [future flag](https://reactrouter.com/v6/guides/api-development-strategy) to avoid issues with existing incompatible `Suspense` usages. We recommend folks adopting this flag to be better compatible with React concurrent mode, but if you run into issues you can continue without the use of `startTransition` until v7. Issues usually boils down to creating net-new promises during the render cycle, so if you run into issues you should either lift your promise creation out of the render cycle or put it behind a `useMemo`. ([#10596](https://github.com/remix-run/react-router/pull/10596))
|
|
770
684
|
|
|
771
685
|
Existing behavior will no longer include `React.startTransition`:
|
|
772
686
|
|
|
@@ -849,7 +763,7 @@ No significant changes to this package were made in this release. [See the repo
|
|
|
849
763
|
|
|
850
764
|
### Minor Changes
|
|
851
765
|
|
|
852
|
-
- Added support for [**Future Flags**](https://reactrouter.com/
|
|
766
|
+
- Added support for [**Future Flags**](https://reactrouter.com/v6/guides/api-development-strategy) in React Router. The first flag being introduced is `future.v7_normalizeFormMethod` which will normalize the exposed `useNavigation()/useFetcher()` `formMethod` fields as uppercase HTTP methods to align with the `fetch()` behavior. ([#10207](https://github.com/remix-run/react-router/pull/10207))
|
|
853
767
|
|
|
854
768
|
- When `future.v7_normalizeFormMethod === false` (default v6 behavior),
|
|
855
769
|
- `useNavigation().formMethod` is lowercase
|
|
@@ -1126,7 +1040,7 @@ function Comp() {
|
|
|
1126
1040
|
|
|
1127
1041
|
## 6.4.0
|
|
1128
1042
|
|
|
1129
|
-
Whoa this is a big one! `6.4.0` brings all the data loading and mutation APIs over from Remix. Here's a quick high level overview, but it's recommended you go check out the [docs](https://reactrouter.com), especially the [feature overview](https://reactrouter.com/start/overview) and the [tutorial](https://reactrouter.com/start/tutorial).
|
|
1043
|
+
Whoa this is a big one! `6.4.0` brings all the data loading and mutation APIs over from Remix. Here's a quick high level overview, but it's recommended you go check out the [docs](https://reactrouter.com), especially the [feature overview](https://reactrouter.com/en/6.4.0/start/overview) and the [tutorial](https://reactrouter.com/en/6.4.0/start/tutorial).
|
|
1130
1044
|
|
|
1131
1045
|
**New APIs**
|
|
1132
1046
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.0.0
|
|
2
|
+
* react-router v7.0.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -6980,7 +6980,7 @@ function mergeRefs(...refs) {
|
|
|
6980
6980
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
6981
6981
|
try {
|
|
6982
6982
|
if (isBrowser) {
|
|
6983
|
-
window.__reactRouterVersion = "7.0.0
|
|
6983
|
+
window.__reactRouterVersion = "7.0.0";
|
|
6984
6984
|
}
|
|
6985
6985
|
} catch (e) {
|
|
6986
6986
|
}
|
|
@@ -8571,9 +8571,10 @@ function createStaticHandlerDataRoutes(manifest, future, parentId = "", routesBy
|
|
|
8571
8571
|
// context even though we know it'll always be provided in remix
|
|
8572
8572
|
loader: route.module.loader ? async (args) => {
|
|
8573
8573
|
if (args.request.headers.has("X-React-Router-Prerender-Data")) {
|
|
8574
|
-
|
|
8574
|
+
const preRenderedData = args.request.headers.get(
|
|
8575
8575
|
"X-React-Router-Prerender-Data"
|
|
8576
8576
|
);
|
|
8577
|
+
let encoded = preRenderedData ? decodeURI(preRenderedData) : preRenderedData;
|
|
8577
8578
|
invariant3(encoded, "Missing prerendered data for route");
|
|
8578
8579
|
let uint8array = new TextEncoder().encode(encoded);
|
|
8579
8580
|
let stream = new ReadableStream({
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An object of unknown type for route loaders and actions provided by the
|
|
3
|
+
* server's `getLoadContext()` function. This is defined as an empty interface
|
|
4
|
+
* specifically so apps can leverage declaration merging to augment this type
|
|
5
|
+
* globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
|
|
6
|
+
*/
|
|
7
|
+
interface AppLoadContext {
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type { AppLoadContext as A };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An object of unknown type for route loaders and actions provided by the
|
|
3
|
+
* server's `getLoadContext()` function. This is defined as an empty interface
|
|
4
|
+
* specifically so apps can leverage declaration merging to augment this type
|
|
5
|
+
* globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
|
|
6
|
+
*/
|
|
7
|
+
interface AppLoadContext {
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type { AppLoadContext as A };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { R as RouterProviderProps$1 } from './fog-of-war-BDQTYoRQ.mjs';
|
|
3
|
+
import './route-data-DuV3tXo2.mjs';
|
|
4
|
+
|
|
5
|
+
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
6
|
+
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @category Router Components
|
|
10
|
+
*/
|
|
11
|
+
declare function HydratedRouter(): React.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { HydratedRouter, RouterProvider, type RouterProviderProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterProviderProps$1 } from './fog-of-war-
|
|
3
|
-
import './
|
|
2
|
+
import { R as RouterProviderProps$1 } from './fog-of-war-CbNQuoo8.js';
|
|
3
|
+
import './route-data-DuV3tXo2.js';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
6
6
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.0.0
|
|
2
|
+
* react-router v7.0.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
matchRoutes,
|
|
26
26
|
shouldHydrateRouteLoader,
|
|
27
27
|
useFogOFWarDiscovery
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-U6WQEHBI.mjs";
|
|
29
29
|
|
|
30
30
|
// lib/dom-export/dom-router-provider.tsx
|
|
31
31
|
import * as React from "react";
|