Skip to content

Commit e31168f

Browse files
committed
Update release notes
1 parent 05da793 commit e31168f

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,17 +414,21 @@ The biggest set of changes in `7.8.0` are to the `unstable_middleware` API's as
414414

415415
⚠️ _[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use_
416416

417+
- `react-router` - **RSC**: Fix 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))
417418
- `react-router` - **Middleware**: Change the `unstable_getContext` signature on `RouterProvider`, `HydratedRouter`, and `unstable_RSCHydratedRouter` so that it returns an `unstable_RouterContextProvider` instance instead of a `Map` used to construct the instance internally ([#14097](https://github.com/remix-run/react-router/pull/14097))
419+
- See the [docs](https://reactrouter.com/api/data-routers/createBrowserRouter#optsunstable_getcontext) for more information
418420
- ⚠️ This is a breaking change if you have adopted the `unstable_getContext` prop
419421
- `react-router` - **Middleware**: Run client middleware on client navigations even if no loaders exist ([#14106](https://github.com/remix-run/react-router/pull/14106))
420422
- `react-router` - **Middleware**: Convert internal middleware implementations to use the new `unstable_generateMiddlewareResponse` API ([#14103](https://github.com/remix-run/react-router/pull/14103))
421423
- `react-router` - **Middleware**: Ensure resource route errors go through `handleError` w/middleware enabled ([#14078](https://github.com/remix-run/react-router/pull/14078))
422424
- `react-router` - **Middleware**: Propagate returned `Response` from server middleware if `next` wasn't called ([#14093](https://github.com/remix-run/react-router/pull/14093))
423425
- `react-router` - **Middleware**: Allow server middlewares to return `data()` values which will be converted into a `Response` ([#14093](https://github.com/remix-run/react-router/pull/14093), [#14128](https://github.com/remix-run/react-router/pull/14128))
424426
- `react-router` - **Middleware**: 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))
427+
- See the [error handling docs](https://reactrouter.com/how-to/middleware#next-and-error-handling) for more information
425428
- ⚠️ This changes existing functionality so if you are currently wrapping `next` calls in `try`/`catch` you should be able to remove those
426-
- `react-router` - **Middleware**: 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))
429+
- `react-router` - **Middleware**: When middleware is enabled, make the `context` parameter read-only (`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))
427430
- `react-router` - **Middleware**: 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))
431+
- This only impacts users using `createStaticHandler()` for manual data loading during non-Framework Mode SSR
428432
- The API has been renamed to `unstable_generateMiddlewareResponse` for clarity
429433
- 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
430434
- The `query` version of the API now has a signature of `(query: (r: Request) => Promise<StaticHandlerContext | Response>) => Promise<Response>`
@@ -451,9 +455,9 @@ The biggest set of changes in `7.8.0` are to the `unstable_middleware` API's as
451455
});
452456
```
453457

454-
- `react-router` - **RSC**: Fix 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))
455458
- `@react-router/{architect,cloudflare,express,node}` - **Middleware**: Change the `getLoadContext` signature (`type GetLoadContextFunction`) when `future.unstable_middleware` is enabled so that it returns an `unstable_RouterContextProvider` instance instead of a `Map` used to construct the instance internally ([#14097](https://github.com/remix-run/react-router/pull/14097))
456459
- This also removes the `type unstable_InitialContext` export
460+
- See the [middleware `getLoadContext` docs](https://reactrouter.com/how-to/middleware#changes-to-getloadcontextapploadcontext) for more information
457461
- ⚠️ This is a breaking change if you have adopted middleware and are using a custom server with a `getLoadContext` function
458462

459463
### Changes by Package

packages/react-router/lib/dom/lib.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,23 @@ export interface DOMRouterOpts {
143143
* [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
144144
* This function is called to generate a fresh `context` instance on each
145145
* navigation or fetcher call.
146+
*
147+
* ```tsx
148+
* import {
149+
* unstable_createContext,
150+
* unstable_RouterContextProvider,
151+
* } from "react-router";
152+
*
153+
* const apiClientContext = unstable_createContext<APIClient>();
154+
*
155+
* function createBrowserRouter(routes, {
156+
* unstable_getContext() {
157+
* let context = new unstable_RouterContextProvider();
158+
* context.set(apiClientContext, getApiClient());
159+
* return context;
160+
* }
161+
* })
162+
* ```
146163
*/
147164
unstable_getContext?: RouterInit["unstable_getContext"];
148165
/**
@@ -153,7 +170,7 @@ export interface DOMRouterOpts {
153170
* When Server-Rendering and opting-out of automatic hydration, the
154171
* `hydrationData` option allows you to pass in hydration data from your
155172
* server-render. This will almost always be a subset of data from the
156-
* {@link StaticHandlerContext} value you get back from {@link StaticHandler}'s
173+
* {@link StaticHandlerContext} value you get back from the {@link StaticHandler}'s
157174
* `query` method:
158175
*
159176
* ```tsx

0 commit comments

Comments
 (0)