You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/react-router/CHANGELOG.md
+32-41Lines changed: 32 additions & 41 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,26 +11,50 @@
11
11
12
12
### Patch Changes
13
13
14
-
- \[UNSTABLE] Ensure resource route errors go through `handleError` w/middleware enabled ([#14078](https://github.com/remix-run/react-router/pull/14078))
15
-
16
-
- \[REMOVE] Few additional fixes for returning/throwing data from middleware - attach to #14093 ([#14128](https://github.com/remix-run/react-router/pull/14128))
17
-
18
14
- Prevent _"Did not find corresponding fetcher result"_ console error when navigating during a `fetcher.submit` revalidation ([#14114](https://github.com/remix-run/react-router/pull/14114))
19
15
20
16
- Bubble client-side middleware errors prior to `next` to the appropriate ancestor error boundary ([#14138](https://github.com/remix-run/react-router/pull/14138))
21
17
22
18
- Switch Lazy Route Discovery manifest URL generation to usea standalone `URLSearchParams` instance instead of `URL.searchParams` to avoid a major performance bottleneck in Chrome ([#14084](https://github.com/remix-run/react-router/pull/14084))
23
19
20
+
- Adjust internal RSC usage of `React.use` to avoid Webpack compilation errors when using React 18 ([#14113](https://github.com/remix-run/react-router/pull/14113))
21
+
22
+
- Remove dependency on `@types/node` in TypeScript declaration files ([#14059](https://github.com/remix-run/react-router/pull/14059))
23
+
24
+
- Fix types for `UIMatch` to reflect that the `loaderData`/`data` properties may be `undefined` ([#12206](https://github.com/remix-run/react-router/pull/12206))
25
+
- 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
26
+
- 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
27
+
- ⚠️ 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.
28
+
29
+
```tsx
30
+
// app/root.tsx
31
+
export function loader() {
32
+
someFunctionThatThrows(); // ❌ Throws an Error
33
+
return { title: "My Title" };
34
+
}
35
+
36
+
export function Layout({ children }: { children: React.ReactNode }) {
37
+
let matches = useMatches();
38
+
let rootMatch = matches[0] as UIMatch<Awaited<ReturnType<typeof loader>>>;
39
+
// ^ rootMatch.data is incorrectly typed here, so TypeScript does not
40
+
// complain if you do the following which throws an error at runtime:
41
+
let { title } = rootMatch.data; // 💥
42
+
43
+
return <html>...</html>;
44
+
}
45
+
```
46
+
47
+
- \[UNSTABLE] Ensure resource route errors go through `handleError` w/middleware enabled ([#14078](https://github.com/remix-run/react-router/pull/14078))
48
+
24
49
- \[UNSTABLE] Propagate returned Response from server middleware if next wasn't called ([#14093](https://github.com/remix-run/react-router/pull/14093))
25
50
26
51
- \[UNSTABLE] Allow server middlewares to return `data()` values which will be converted into a `Response` ([#14093](https://github.com/remix-run/react-router/pull/14093))
27
52
28
53
- \[UNSTABLE] Update middleware error handling so that the `next` function never throws and instead handles any middleware errors at the proper `ErrorBoundary` and returns the `Response` up through the ancestor `next` function ([#14118](https://github.com/remix-run/react-router/pull/14118))
29
54
30
-
- - \[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))
55
+
- \[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))
31
56
32
57
- \[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))
33
-
34
58
- The API has been renamed to `unstable_generateMiddlewareResponse` for clarity
35
59
- 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
36
60
- The `query` version of the API now has a signature of `(query: (r: Request) => Promise<StaticHandlerContext | Response>) => Promise<Response>`
@@ -59,46 +83,18 @@
59
83
60
84
- \[UNSTABLE] Convert internal middleware implementations to use the new `unstable_generateMiddlewareResponse` API ([#14103](https://github.com/remix-run/react-router/pull/14103))
61
85
62
-
- Adjust internal RSC usage of `React.use` to avoid Webpack compilation errors when using React 18 ([#14113](https://github.com/remix-run/react-router/pull/14113))
63
-
64
86
- \[UNSTABLE] Change `getLoadContext` signature (`type GetLoadContextFunction`) when `future.unstable_middleware` is enabled so that it returns an `unstable_RouterContextProvider` instance instead of a `Map` used to contruct the instance internally ([#14097](https://github.com/remix-run/react-router/pull/14097))
65
87
- This also removes the `type unstable_InitialContext` export
66
88
- ⚠️ This is a breaking change if you have adopted middleware and are using a custom server with a `getLoadContext` function
67
89
68
-
- Remove dependency on `@types/node` in TypeScript declaration files ([#14059](https://github.com/remix-run/react-router/pull/14059))
69
-
70
-
- Fix types for `UIMatch` to reflect that the `loaderData`/`data` properties may be `undefined` ([#12206](https://github.com/remix-run/react-router/pull/12206))
71
-
72
-
- 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
73
-
- 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
74
-
- ⚠️ 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.
75
-
76
-
```tsx
77
-
// app/root.tsx
78
-
export function loader() {
79
-
someFunctionThatThrows(); // ❌ Throws an Error
80
-
return { title: "My Title" };
81
-
}
82
-
83
-
export function Layout({ children }: { children: React.ReactNode }) {
84
-
let matches = useMatches();
85
-
let rootMatch = matches[0] as UIMatch<Awaited<ReturnType<typeof loader>>>;
86
-
// ^ rootMatch.data is incorrectly typed here, so TypeScript does not
87
-
// complain if you do the following which throws an error at runtime:
88
-
let { title } = rootMatch.data; // 💥
89
-
90
-
return <html>...</html>;
91
-
}
92
-
```
93
-
94
90
- \[UNSTABLE] Run client middleware on client navigations even if no loaders exist ([#14106](https://github.com/remix-run/react-router/pull/14106))
95
91
96
92
- \[UNSTABLE] Change the `unstable_getContext` signature on `RouterProvider`/`HydratedRouter`/`unstable_RSCHydratedRouter` so that it returns an `unstable_RouterContextProvider` instance instead of a `Map` used to contruct the instance internally ([#14097](https://github.com/remix-run/react-router/pull/14097))
97
93
- ⚠️ This is a breaking change if you have adopted the `unstable_getContext` prop
98
94
99
-
- proxy server action side-effect redirects from actions for document and callServer requests ([#14131](https://github.com/remix-run/react-router/pull/14131))
95
+
- [UNSTABLE] proxy server action side-effect redirects from actions for document and callServer requests ([#14131](https://github.com/remix-run/react-router/pull/14131))
100
96
101
-
- Fix RSC Data Mode issue where routes that return `false` from `shouldRevalidate` would be replaced by an `<Outlet />` ([#14071](https://github.com/remix-run/react-router/pull/14071))
97
+
- [UNSTABLE] Fix RSC Data Mode issue where routes that return `false` from `shouldRevalidate` would be replaced by an `<Outlet />` ([#14071](https://github.com/remix-run/react-router/pull/14071))
102
98
103
99
## 7.7.1
104
100
@@ -704,7 +700,6 @@
704
700
```
705
701
706
702
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:
- Remove `future.v7_normalizeFormMethod` future flag ([#11697](https://github.com/remix-run/react-router/pull/11697))
893
888
894
889
- 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))
895
-
896
890
- `createCookie`
897
891
- `createCookieSessionStorage`
898
892
- `createMemorySessionStorage`
@@ -901,7 +895,6 @@ _No changes_
901
895
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)
902
896
903
897
Since platform-specific packages no longer need to implement this API, the following low-level APIs have been removed:
904
-
905
898
- `createCookieFactory`
906
899
- `createSessionStorageFactory`
907
900
- `createCookieSessionStorageFactory`
@@ -1057,7 +1050,6 @@ _No changes_
1057
1050
```
1058
1051
1059
1052
This initial implementation targets type inference for:
1060
-
1061
1053
- `Params` : Path parameters from your routing config in `routes.ts` including file-based routing
1062
1054
- `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
1063
1055
- `ActionData` : Action data from `action` and/or `clientAction` within your route module
@@ -1072,7 +1064,6 @@ _No changes_
1072
1064
```
1073
1065
1074
1066
Check out our docs for more:
1075
-
1076
1067
- [_Explanations > Type Safety_](https://reactrouter.com/dev/guides/explanation/type-safety)
1077
1068
- [_How-To > Setting up type safety_](https://reactrouter.com/dev/guides/how-to/setting-up-type-safety)
0 commit comments