Skip to content

Commit ca0133e

Browse files
committed
Merge branch 'main' into release-next
2 parents 45a91e0 + 880ab96 commit ca0133e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+304
-236
lines changed

contributors.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- airjp73
1414
- airondumael
1515
- aissa-bouguern
16+
- ajtorres9
1617
- akamfoad
1718
- alanhoskins
1819
- Alarid
@@ -157,6 +158,7 @@
157158
- frandiox
158159
- freeman
159160
- frontsideair
161+
- furkanakkurt1335
160162
- fx109138
161163
- gabimor
162164
- garand
@@ -289,6 +291,7 @@
289291
- kuldar
290292
- kumard3
291293
- lachlanjc
294+
- larister
292295
- laughnan
293296
- lawrencecchen
294297
- leifarriens
@@ -459,6 +462,7 @@
459462
- sergiodxa
460463
- shairez
461464
- shashankboosi
465+
- shininglovestar
462466
- shubhaguha
463467
- shumuu
464468
- sidkh
@@ -471,6 +475,7 @@
471475
- sjparsons
472476
- skube
473477
- sndrem
478+
- smeijer
474479
- sobrinho
475480
- squidpunch
476481
- staylor
@@ -541,3 +546,6 @@
541546
- yudai-nkt
542547
- baby230211
543548
- TomVance
549+
- amir-ziaei
550+
- mrkhosravian
551+
- tanerijun

docs/file-conventions/route-files-v2.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ new: true
55

66
# Route File Naming (v2)
77

8-
You can opt-in to the new route file naming convention with a future flag in Remix config.
8+
You can opt in to the new route file naming convention with a future flag in Remix config.
99

1010
```js filename=remix.config.js
1111
/** @type {import('@remix-run/dev').AppConfig} */
@@ -18,7 +18,7 @@ module.exports = {
1818

1919
While you can configure routes in [remix.config.js][remix-config], most routes are created with this file system convention. Add a file, get a route.
2020

21-
Please note that you can use either `.jsx` or `.tsx` file extensions. We'll stick with `.tsx` in the examples to avoid duplication.
21+
Please note that you can use either `.js`, `.jsx`, `.ts` or `.tsx` file extensions. We'll stick with `.tsx` in the examples to avoid duplication.
2222

2323
## Root Route
2424

@@ -29,7 +29,7 @@ app/
2929
└── root.tsx
3030
```
3131

32-
The file in `app/root.tsx` is your root layout, or "root route" (very sorry for those of you who pronounce those words the same way!). It works just like all other routes so you can export a [`loader`][loader], [`action`][action], etc.
32+
The file in `app/root.tsx` is your root layout, or "root route" (very sorry for those of you who pronounce those words the same way!). It works just like all other routes, so you can export a [`loader`][loader], [`action`][action], etc.
3333

3434
The root route typically looks something like this. It serves as the root layout of the entire app, all other routes will render inside the `<Outlet />`.
3535

@@ -84,7 +84,7 @@ Note that these routes will be rendered in the outlet of `app/root.tsx` because
8484
Adding a `.` to a route filename will create a `/` in the URL.
8585

8686
<!-- prettier-ignore -->
87-
```markdown lines=[4-6]
87+
```markdown lines=[5-7]
8888
app/
8989
├── routes/
9090
│ ├── _index.tsx
@@ -166,7 +166,7 @@ app/
166166
└── root.tsx
167167
```
168168

169-
All of the routes that start with `concerts.` will be child routes of `concerts.tsx` and render inside the parent route's [outlet][outlet].
169+
All the routes that start with `concerts.` will be child routes of `concerts.tsx` and render inside the parent route's [outlet][outlet].
170170

171171
| URL | Matched Route | Layout |
172172
| -------------------------- | ----------------------- | -------------- |
@@ -180,7 +180,7 @@ Note you typically want to add an index route when you add nested routes so that
180180

181181
## Nested URLs without Layout Nesting
182182

183-
Sometimes you want the URL to be nested but you don't want the automatic layout nesting. You can opt-out of nesting with a trailing underscore on the parent segment:
183+
Sometimes you want the URL to be nested, but you don't want the automatic layout nesting. You can opt out of nesting with a trailing underscore on the parent segment:
184184

185185
<!-- prettier-ignore -->
186186
```markdown lines=[8]
@@ -260,7 +260,7 @@ app/
260260

261261
## Splat Routes
262262

263-
While [dynamic segments][dynamic-segments] match a single path segment (the stuff between two `/` in a url), a splat route will match the rest of a URL, including the slashes.
263+
While [dynamic segments][dynamic-segments] match a single path segment (the stuff between two `/` in a URL), a splat route will match the rest of a URL, including the slashes.
264264

265265
<!-- prettier-ignore -->
266266
```markdown lines=[4,6]

docs/file-conventions/routes-files.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ title: Route File Naming
88

99
Setting up routes in Remix is as simple as creating files in your `app` directory. These are the conventions you should know to understand how routing in Remix works.
1010

11-
Please note that you can use either `.js`, `.jsx` or `.tsx` file extensions depending on whether or not you use TypeScript. We'll stick with `.tsx` in the examples to avoid duplication.
11+
Please note that you can use either `.js`, `.jsx`, `.ts` or `.tsx` file extensions. We'll stick with `.tsx` in the examples to avoid duplication.
1212

1313
## Root Route
1414

@@ -167,7 +167,7 @@ app/
167167

168168
</details>
169169

170-
In the example above, the `blog.tsx` is a "layout route" for everything within the `blog` directory (`blog/index.tsx` and `blog/categories.tsx`). When a route has the same name as its directory (`routes/blog.tsx` and `routes/blog/`), it becomes a layout route for all of the routes inside that directory ("child routes"). Similar to your [root route][root-route], the parent route should render an `<Outlet />` where the child routes should appear. This is how you can create multiple levels of persistent layout nesting associated with URLs.
170+
In the example above, the `blog.tsx` is a "layout route" for everything within the `blog` directory (`blog/index.tsx` and `blog/categories.tsx`). When a route has the same name as its directory (`routes/blog.tsx` and `routes/blog/`), it becomes a layout route for all the routes inside that directory ("child routes"). Similar to your [root route][root-route], the parent route should render an `<Outlet />` where the child routes should appear. This is how you can create multiple levels of persistent layout nesting associated with URLs.
171171

172172
## Pathless Layout Routes
173173

docs/guides/constraints.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ The server needs everything in this file but the browser only needs the componen
4343

4444
To remove the server code from the browser bundles, the Remix compiler creates a proxy module in front of your route and bundles that instead. The proxy for this route would look like:
4545

46-
```ts
46+
```tsx
4747
export { meta, default } from "./routes/posts.tsx";
4848
```
4949

docs/guides/data-loading.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default function Products() {
4545
}
4646
```
4747

48-
The component renders on the server and in the browser. The loader _only runs on the server_. That means our hard-coded products array doesn't get included in the browser bundles and it's safe to use server-only for APIs and SDKs for things like database, payment processing, content management systems, etc.
48+
The component renders on the server and in the browser. The loader _only runs on the server_. That means our hard-coded products array doesn't get included in the browser bundles, and it's safe to use server-only for APIs and SDKs for things like database, payment processing, content management systems, etc.
4949

5050
If your server-side modules end up in client bundles, move the imports for those modules to a file named `{something}.server.ts` with the `.server.ts` suffix to ensure they are excluded.
5151

@@ -107,9 +107,9 @@ While you may be uncomfortable throwing errors like this with `invariant` when i
107107

108108
## External APIs
109109

110-
Remix polyfills the `fetch` API on your server so it's very easy to fetch data from existing JSON APIs. Instead of managing state, errors, race conditions, and more yourself, you can do the fetch from your loader (on the server) and let Remix handle the rest.
110+
Remix polyfills the `fetch` API on your server, so it's very easy to fetch data from existing JSON APIs. Instead of managing state, errors, race conditions, and more yourself, you can do the fetch from your loader (on the server) and let Remix handle the rest.
111111

112-
```tsx filename=app/routes/gists.jsx lines=[5]
112+
```tsx filename=app/routes/gists.tsx lines=[5]
113113
import { json } from "@remix-run/node"; // or cloudflare/deno
114114
import { useLoaderData } from "@remix-run/react";
115115

@@ -314,7 +314,7 @@ Given the following URLs, the search params would be parsed as follows:
314314

315315
### Data Reloads
316316

317-
When multiple nested routes are rendering and the search params change, all of the routes will be reloaded (instead of just the new or changed routes). This is because search params are a cross-cutting concern and could affect any loader. If you would like to prevent some of your routes from reloading in this scenario, use [shouldRevalidate][should-revalidate].
317+
When multiple nested routes are rendering and the search params change, all the routes will be reloaded (instead of just the new or changed routes). This is because search params are a cross-cutting concern and could affect any loader. If you would like to prevent some of your routes from reloading in this scenario, use [shouldRevalidate][should-revalidate].
318318

319319
### Search Params in Components
320320

@@ -471,7 +471,7 @@ export default function ProductFilters() {
471471

472472
Often you want to keep some inputs, like checkboxes, in sync with the search params in the URL. This can get a little tricky with React's controlled component concept.
473473

474-
This is only needed if the search params can be set in two ways and we want the inputs to stay in sync with the search params. For example, both the `<input type="checkbox">` and the `Link` can change the brand in this component:
474+
This is only needed if the search params can be set in two ways, and we want the inputs to stay in sync with the search params. For example, both the `<input type="checkbox">` and the `Link` can change the brand in this component:
475475

476476
```tsx bad lines=[11-18]
477477
import { useSearchParams } from "@remix-run/react";
@@ -514,7 +514,7 @@ If the user clicks the checkbox and submits the form, the URL updates and the ch
514514

515515
Now we have the opposite problem: clicking the link updates both the URL and the checkbox state but _the checkbox no longer works_ because React prevents the state from changing until the URL that controls it changes--and it never will because we can't change the checkbox and resubmit the form.
516516

517-
React wants you to control it with some state but we want the user to control it until they submit the form, and then we want the URL to control it when it changes. So we're in this "sorta-controlled" spot.
517+
React wants you to control it with some state, but we want the user to control it until they submit the form, and then we want the URL to control it when it changes. So we're in this "sorta-controlled" spot.
518518

519519
You have two choices, and what you pick depends on the user experience you want.
520520

@@ -657,9 +657,9 @@ function SearchCheckbox({ name, value }) {
657657

658658
Remix optimizes the user experiences by only loading the data for the parts of the page that are changing on navigation. For example, consider the UI you're using right now in these docs. The navbar on the side is in a parent route that fetched the dynamically-generated menu of all the docs, and the child route fetched the document you're reading right now. If you click a link in the sidebar, Remix knows that the parent route will remain on the page - but the child route's data will change because the url param for the document will change. With this insight, Remix _will not refetch the parent route's data_.
659659

660-
Without Remix the next question is "how do I reload all of the data?". This is built into Remix as well. Whenever an [action][action] is called (the user submitted a form or you, the programmer, called `submit` from `useSubmit`), Remix will automatically reload all of the routes on the page to capture any changes that might have happened.
660+
Without Remix the next question is "how do I reload all the data?". This is built into Remix as well. Whenever an [action][action] is called (the user submitted a form or you, the programmer, called `submit` from `useSubmit`), Remix will automatically reload all the routes on the page to capture any changes that might have happened.
661661

662-
You don't have to worry about expiring caches or avoid overfetching data as the user interacts with your app, it's all automatic.
662+
You don't have to worry about expiring caches or avoid over-fetching data as the user interacts with your app, it's all automatic.
663663

664664
There are three cases where Remix will reload all of your routes:
665665

@@ -671,7 +671,7 @@ All of these behaviors emulate the browser's default behavior. In these cases, R
671671

672672
## Data Libraries
673673

674-
Thanks to Remix's data conventions and nested routes, you'll usually find you don't need to reach for client side data libraries like React Query, SWR, Apollo, Relay, urql and others. If you're using global state management libraries like redux, primarily for interacting with data on the server, it's also unlikely you'll need those.
674+
Thanks to Remix's data conventions and nested routes, you'll usually find you don't need to reach for client side data libraries like React Query, SWR, Apollo, Relay, `urql` and others. If you're using global state management libraries like redux, primarily for interacting with data on the server, it's also unlikely you'll need those.
675675

676676
Of course, Remix doesn't prevent you from using them (unless they require bundler integration). You can bring whatever React data libraries you like and use them wherever you think they'll serve your UI better than the Remix APIs. In some cases you can use Remix for the initial server render and then switch over to your favorite library for the interactions afterward.
677677

docs/guides/mdx.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,7 @@ import Component, {
126126

127127
The following example demonstrates how you might build a simple blog with MDX, including individual pages for the posts themselves and an index page that shows all posts.
128128

129-
In `app/routes/index.jsx`:
130-
131-
```tsx
129+
```tsx filename=app/routes/index.tsx
132130
import { json } from "@remix-run/node"; // or cloudflare/deno
133131
import { Link, useLoaderData } from "@remix-run/react";
134132

@@ -182,7 +180,7 @@ Clearly this is not a scalable solution for a blog with thousands of posts. Real
182180

183181
If you wish to configure your own remark plugins you can do so through the `remix.config.js`'s `mdx` export:
184182

185-
```ts
183+
```js filename=remix.config.js
186184
const {
187185
remarkMdxFrontmatter,
188186
} = require("remark-mdx-frontmatter");

0 commit comments

Comments
 (0)