Skip to content

Commit ed1196f

Browse files
committed
Merge branch 'main' into release-next
2 parents bc4078e + e5aa541 commit ed1196f

File tree

12 files changed

+109
-26
lines changed

12 files changed

+109
-26
lines changed

GOVERNANCE.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,12 @@ Due to the large number of React Router applications out there, we have to be a
7474

7575
## New Feature Process
7676

77-
The process for new features being added to React Router will follow a series of stages loosely based on the [TC39 Process](https://tc39.es/process-document/). It is important to note that entrance into any given stage does not imply that an RFC will proceed any further. The stages will act as a funnel with fewer RFCs making it into later stages such that only the strongest RFCs make it into a React Router release in a stable fashion. This table gives a high-level overview of the stages, but please see the individual stage sections below for more detailed information on the stages and the process for moving an FC through them.
77+
The process for new features being added to React Router will follow a series of stages loosely based on the [TC39 Process](https://tc39.es/process-document/). It is important to note that entrance into any given stage does not imply that an RFC will proceed any further. The stages will act as a funnel with fewer RFCs making it into later stages such that only the strongest RFCs make it into a React Router release in a stable fashion.
7878

79-
Once a feature reaches Stage 2, it will be added to the [Roadmap](https://github.com/orgs/remix-run/projects/5) where it can be tracked as it moves through the stages.
79+
> [!NOTE]
80+
> Most new community-driven features for React Router will go through all stages. Some features, if trivial or obvious enough, may skip stages and be implemented directly as a stable feature.
81+
82+
This table gives a high-level overview of the stages, but please see the individual stage sections below for more detailed information on the stages and the process for moving an FC through them. Once a feature reaches Stage 2, it will be added to the [Roadmap](https://github.com/orgs/remix-run/projects/5) where it can be tracked as it moves through the stages.
8083

8184
| Stage | Name | Entrance Criteria | Purpose |
8285
| ----- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -87,8 +90,6 @@ Once a feature reaches Stage 2, it will be added to the [Roadmap](https://github
8790
| 4 | Stabilization | At least 1 month in the Beta stage and PR opened to stabilize the APIs. This PR should also include documentation for the new feature. | The **Stabilization** phase exists to ensure that unstable features are available for enough time for applications to update their React Router version and opt-into beta testing. We don't want to rush features through beta testing so that we have maximal feedback prior to stabilizing a feature. |
8891
| 5 | Stable | PR approval from at least 50% of the SC members indicating their acceptance of the PR for a stable API | A RFC is completed and enters the **Stable** stage once enough members of the SC feel comfortable not only with the code for the stable feature, but have also seen positive feedback from beta testers that the feature is working as expected. Once an **Beta** stage PR has enough SC approvals and has spent the required amount of time in the **Beta** stage, it can be merged and included in the next React Router release. |
8992

90-
To get a feature accepted and implemented in React Router, it will go through the following stages:
91-
9293
## New Feature Stages
9394

9495
### Stage 0 — Proposal

contributors.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
- bvangraafeiland
6767
- camthompson
6868
- CanRau
69+
- caprolactam
6970
- cassidoo
7071
- chaance
7172
- chasinhues
@@ -238,6 +239,7 @@
238239
- markdalgleish
239240
- markivancho
240241
- markmals
242+
- Marlon-Buckley
241243
- maruffahmed
242244
- marvinruder
243245
- mathpaquette
@@ -355,6 +357,7 @@
355357
- sorokya
356358
- sorrycc
357359
- souzasmatheus
360+
- SovietGhost
358361
- soxtoby
359362
- srmagura
360363
- SsongQ-92

docs/api/framework-conventions/server-modules.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ title: .server modules
1111
Server-only modules that are excluded from client bundles and only run on the server.
1212

1313
```ts filename=auth.server.ts
14-
// This would expose secrets on the client
14+
// This would expose secrets on the client if not exported from a server-only module
1515
export const JWT_SECRET = process.env.JWT_SECRET;
1616

1717
export function validateToken(token: string) {
@@ -21,12 +21,19 @@ export function validateToken(token: string) {
2121

2222
`.server` modules are a good way to explicitly mark entire modules as server-only. The build will fail if any code in a `.server` file or `.server` directory accidentally ends up in the client module graph.
2323

24+
<docs-warning>
25+
26+
Route modules should not be marked as `.server` or `.client` as they have special handling and need to be referenced in both server and client module graphs. Attempting to do so will cause build errors.
27+
28+
</docs-warning>
29+
2430
<docs-info>
2531

2632
If you need more sophisticated control over what is included in the client/server bundles, check out the [`vite-env-only` plugin](https://github.com/pcattori/vite-env-only).
2733

2834
</docs-info>
2935

36+
3037
## Usage Patterns
3138

3239
### Individual Files

docs/api/hooks/useSearchParams.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ setSearchParams([["tab", "1"]]);
5959
setSearchParams(new URLSearchParams("?tab=1"));
6060
```
6161

62-
It also supports a function callback like React's [`setState`](https://react.dev/reference/react/useState#setstate):
62+
It also supports a function callback like React's
63+
[`setState`](https://react.dev/reference/react/useState#setstate):
6364

6465
```tsx
6566
setSearchParams((searchParams) => {
@@ -68,6 +69,12 @@ setSearchParams((searchParams) => {
6869
});
6970
```
7071

72+
<docs-warning>The function callback version of `setSearchParams` does not support
73+
the [queueing](https://react.dev/reference/react/useState#setstate-parameters)
74+
logic that React's `setState` implements. Multiple calls to `setSearchParams`
75+
in the same tick will not build on the prior value. If you need this behavior,
76+
you can use `setState` manually.</docs-warning>
77+
7178
### Notes
7279

7380
Note that `searchParams` is a stable reference, so you can reliably use it

docs/explanation/code-splitting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Instead of bundling all routes into a single giant build, the modules referenced
3131

3232
Because these entry points are coupled to URL segments, React Router knows just from a URL which bundles are needed in the browser, and more importantly, which are not.
3333

34-
If the user visits `"/about"` then the bundles for `about.tsx` will be loaded but not `contact.tsx`. This ensures drastically reduces the JavaScript footprint for initial page loads and speeds up your application.
34+
If the user visits `"/about"` then the bundles for `about.tsx` will be loaded but not `contact.tsx`. This drastically reduces the JavaScript footprint for initial page loads and speeds up your application.
3535

3636
## Removal of Server Code
3737

docs/how-to/file-uploads.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ title: File Uploads
99
<br/>
1010
<br/>
1111

12-
Handle file uploads in your React Router applications. This guide uses some packages from the [Remix The Web][remix-the-web] project to make file uploads easier.
13-
1412
_Thank you to David Adams for [writing an original guide](https://programmingarehard.com/2024/09/06/remix-file-uploads-updated.html/) on which this doc is based. You can refer to it for even more examples._
1513

1614
## Basic File Upload
@@ -38,7 +36,7 @@ export default [
3836
`form-data-parser` is a wrapper around `request.formData()` that provides streaming support for handling file uploads.
3937

4038
```shellscript
41-
npm i @mjackson/form-data-parser
39+
npm i @remix-run/form-data-parser
4240
```
4341

4442
[See the `form-data-parser` docs for more information][form-data-parser]
@@ -57,11 +55,12 @@ You must set the form's `enctype` to `multipart/form-data` for file uploads to w
5755
import {
5856
type FileUpload,
5957
parseFormData,
60-
} from "@mjackson/form-data-parser";
58+
} from "@remix-run/form-data-parser";
59+
import type { Route } from "./+types/user-profile";
6160

6261
export async function action({
6362
request,
64-
}: ActionFunctionArgs) {
63+
}: Route.ActionArgs) {
6564
const uploadHandler = async (fileUpload: FileUpload) => {
6665
if (fileUpload.fieldName === "avatar") {
6766
// process the upload and return a File
@@ -93,7 +92,7 @@ export default function Component() {
9392
`file-storage` is a key/value interface for storing [File objects][file] in JavaScript. Similar to how `localStorage` allows you to store key/value pairs of strings in the browser, file-storage allows you to store key/value pairs of files on the server.
9493

9594
```shellscript
96-
npm i @mjackson/file-storage
95+
npm i @remix-run/file-storage
9796
```
9897

9998
[See the `file-storage` docs for more information][file-storage]
@@ -103,7 +102,7 @@ npm i @mjackson/file-storage
103102
Create a file that exports a `LocalFileStorage` instance to be used by different routes.
104103

105104
```ts filename=avatar-storage.server.ts
106-
import { LocalFileStorage } from "@mjackson/file-storage/local";
105+
import { LocalFileStorage } from "@remix-run/file-storage/local";
107106

108107
export const fileStorage = new LocalFileStorage(
109108
"./uploads/avatars",
@@ -122,7 +121,7 @@ Update the form's `action` to store files in the `fileStorage` instance.
122121
import {
123122
type FileUpload,
124123
parseFormData,
125-
} from "@mjackson/form-data-parser";
124+
} from "@remix-run/form-data-parser";
126125
import {
127126
fileStorage,
128127
getStorageKey,
@@ -212,8 +211,7 @@ export async function loader({ params }: Route.LoaderArgs) {
212211
}
213212
```
214213

215-
[remix-the-web]: https://github.com/mjackson/remix-the-web
216-
[form-data-parser]: https://github.com/mjackson/remix-the-web/tree/main/packages/form-data-parser
217-
[file-storage]: https://github.com/mjackson/remix-the-web/tree/main/packages/file-storage
214+
[form-data-parser]: https://www.npmjs.com/package/@remix-run/form-data-parser
215+
[file-storage]: https://www.npmjs.com/package/@remix-run/file-storage
218216
[file]: https://developer.mozilla.org/en-US/docs/Web/API/File
219217
[resource-route]: ../how-to/resource-routes

docs/how-to/headers.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,17 @@ export async function loader({ params }: LoaderArgs) {
5555
Headers from loaders and actions are not sent automatically. You must explicitly return them from the `headers` export.
5656

5757
```tsx
58+
function hasAnyHeaders(headers: Headers): boolean {
59+
return [...headers].length > 0;
60+
}
61+
5862
export function headers({
5963
actionHeaders,
6064
loaderHeaders,
6165
}: HeadersArgs) {
62-
return actionHeaders ? actionHeaders : loaderHeaders;
66+
return hasAnyHeaders(actionHeaders)
67+
? actionHeaders
68+
: loaderHeaders;
6369
}
6470
```
6571

docs/how-to/react-server-components.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ The following naming conventions have been chosen for familiarity and simplicity
256256

257257
See the relevant bundler documentation below for specific code examples for each of the following entry points.
258258

259-
These examples all use [express][express] and [@mjackson/node-fetch-server][node-fetch-server] for the server and request handling.
259+
These examples all use [express][express] and [@remix-run/node-fetch-server][node-fetch-server] for the server and request handling.
260260

261261
**Routes**
262262

@@ -332,7 +332,7 @@ To configure Parcel, add the following to your `package.json`:
332332
"source": "src/entry.rsc.tsx",
333333
"scopeHoist": false,
334334
"includeNodeModules": {
335-
"@mjackson/node-fetch-server": false,
335+
"@remix-run/node-fetch-server": false,
336336
"compression": false,
337337
"express": false
338338
}
@@ -425,7 +425,7 @@ export async function generateHTML(
425425
The following is a simplified example of a Parcel RSC Server.
426426

427427
```tsx filename=src/entry.rsc.tsx
428-
import { createRequestListener } from "@mjackson/node-fetch-server";
428+
import { createRequestListener } from "@remix-run/node-fetch-server";
429429
import express from "express";
430430
import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router";
431431
import {
@@ -781,6 +781,6 @@ createFromReadableStream<RSCServerPayload>(
781781
[get-rsc-stream]: ../api/rsc/getRSCStream
782782
[rsc-hydrated-router]: ../api/rsc/RSCHydratedRouter
783783
[express]: https://expressjs.com/
784-
[node-fetch-server]: https://github.com/mjackson/remix-the-web/tree/main/packages/node-fetch-server
784+
[node-fetch-server]: https://www.npmjs.com/package/@remix-run/node-fetch-server
785785
[parcel-rsc-template]: https://github.com/remix-run/react-router-templates/tree/main/unstable_rsc-parcel
786786
[vite-rsc-template]: https://github.com/remix-run/react-router-templates/tree/main/unstable_rsc-vite

docs/start/data/route-object.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ A route loader is revalidated when:
194194

195195
- its own route params change
196196
- any change to URL search params
197-
- after any actions are called
197+
- after an action is called and returns a non-error status code
198198

199199
By defining this function, you opt out of the default behavior completely and can manually control when loader data is revalidated for navigations and form submissions.
200200

docs/start/framework/routing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ const { "*": splat } = params;
304304
You can also use a splat to catch requests that don't match any route:
305305

306306
```ts filename=app/routes.ts
307-
route("*", "./catchall.tsx"); // catcall route,
307+
route("*", "./catchall.tsx"); // catchall route,
308308
```
309309

310310
```tsx filename=app/catchall.tsx

0 commit comments

Comments
 (0)