Skip to content

Commit 1711d27

Browse files
docs(utils): fix grammar + typos (#10659)
Co-authored-by: Brooks Lybrand <[email protected]>
1 parent de9e657 commit 1711d27

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

docs/utils/cookies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ While you may create these cookies manually, it is more common to use a [session
1414

1515
In Remix, you will typically work with cookies in your `loader` and/or `action` functions (see <Link to="../mutations">mutations</Link>), since those are the places where you need to read and write data.
1616

17-
Let's say you have a banner on your e-commerce site that prompts users to check out the items you currently have on sale. The banner spans the top of your homepage, and includes a button on the side that allows the user to dismiss the banner so they don't see it for at least another week.
17+
Let's say you have a banner on your e-commerce site that prompts users to check out the items you currently have on sale. The banner spans the top of your homepage and includes a button on the side that allows the user to dismiss the banner so they don't see it for at least another week.
1818

1919
First, create a cookie:
2020

docs/utils/data.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ toc: false
55

66
# `data`
77

8-
This is a utility for use with [Single Fetch][single-fetch] to return raw data accompanied with a status code or custom response headers. This avoids the need to serialize your data into a `Response` instance to provide custom status/headers. This is generally a replacement for `loader`/`action` functions that used [`json`][json] or [`defer`][defer] prior to Single Fetch.
8+
This is a utility for use with [Single Fetch][single-fetch] to return raw data accompanied by a status code or custom response headers. This avoids the need to serialize your data into a `Response` instance to provide custom status/headers. This is generally a replacement for `loader`/`action` functions that used [`json`][json] or [`defer`][defer] prior to Single Fetch.
99

1010
```tsx
1111
import { data } from "@remix-run/node"; // or cloudflare/deno

docs/utils/parse-multipart-form-data.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: unstable_parseMultipartFormData
66

77
Allows you to handle multipart forms (file uploads) for your app.
88

9-
Would be useful to understand [the Browser File API][the-browser-file-api] to know how to use this API.
9+
It would be useful to understand [the Browser File API][the-browser-file-api] to know how to use this API.
1010

1111
It's to be used in place of `request.formData()`.
1212

@@ -26,7 +26,7 @@ export const action = async ({
2626
uploadHandler // <-- we'll look at this deeper next
2727
);
2828

29-
// the returned value for the file field is whatever our uploadHandler returns.
29+
// The returned value for the file field is whatever our uploadHandler returns.
3030
// Let's imagine we're uploading the avatar to s3,
3131
// so our uploadHandler returns the URL.
3232
const avatarUrl = formData.get("avatar");

docs/utils/sessions.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ title: Sessions
66

77
Sessions are an important part of websites that allow the server to identify requests coming from the same person, especially when it comes to server-side form validation or when JavaScript is not on the page. Sessions are a fundamental building block of many sites that let users "log in", including social, e-commerce, business, and educational websites.
88

9-
In Remix, sessions are managed on a per-route basis (rather than something like express middleware) in your `loader` and `action` methods using a "session storage" object (that implements the `SessionStorage` interface). Session storage understands how to parse and generate cookies, and how to store session data in a database or filesystem.
9+
In Remix, sessions are managed on a per-route basis (rather than something like express middleware) in your `loader` and `action` methods using a "session storage" object (that implements the `SessionStorage` interface). Session storage understands how to parse and generate cookies and how to store session data in a database or filesystem.
1010

11-
Remix comes with several pre-built session storage options for common scenarios, and one to create your own:
11+
Remix comes with several pre-built session storage options for common scenarios and one to create your own:
1212

1313
- `createCookieSessionStorage`
1414
- `createMemorySessionStorage`
@@ -198,13 +198,13 @@ export default function LogoutRoute() {
198198
}
199199
```
200200

201-
<docs-warning>It's important that you logout (or perform any mutation for that matter) in an `action` and not a `loader`. Otherwise you open your users to [Cross-Site Request Forgery][csrf] attacks. Also, Remix only re-calls `loaders` when `actions` are called.</docs-warning>
201+
<docs-warning>It's important that you log out (or perform any mutation for that matter) in an `action` and not a `loader`. Otherwise, you open your users to [Cross-Site Request Forgery][csrf] attacks. Also, Remix only re-calls `loaders` when `actions` are called.</docs-warning>
202202

203203
## Session Gotchas
204204

205-
- Because of nested routes, multiple loaders can be called to construct a single page. When using `session.flash()` or `session.unset()`, you need to be sure no other loaders in the request are going to want to read that, otherwise you'll get race conditions. Typically if you're using flash, you'll want to have a single loader read it; if another loader wants a flash message, use a different key for that loader.
205+
- Because of nested routes, multiple loaders can be called to construct a single page. When using `session.flash()` or `session.unset()`, you need to be sure no other loaders in the request are going to want to read that, otherwise you'll get race conditions. Typically, if you're using flash, you'll want to have a single loader read it; if another loader wants a flash message, use a different key for that loader.
206206

207-
- Every time you modify session data, you must `commitSession()` or your changes will be lost. This is different than what you might be used to, where some type of middleware automatically commits session data for you.
207+
- Every time you modify session data, you must `commitSession()` or your changes will be lost. This is different from what you might be used to, where some type of middleware automatically commits session data for you.
208208

209209
## `createSession`
210210

@@ -281,7 +281,7 @@ const { getSession, commitSession, destroySession } =
281281
});
282282
```
283283

284-
The `expires` argument to `createData` and `updateData` is the same `Date` at which the cookie itself expires and is no longer valid. You can use this information to automatically purge the session record from your database to save on space, or to ensure that you do not otherwise return any data for old, expired cookies.
284+
The `expires` argument to `createData` and `updateData` is the same `Date` at which the cookie itself expires and is no longer valid. You can use this information to automatically purge the session record from your database to save on space or to ensure that you do not otherwise return any data for old, expired cookies.
285285

286286
## `createCookieSessionStorage`
287287

@@ -291,7 +291,7 @@ The main advantage of cookie session storage is that you don't need any addition
291291

292292
However, cookie-based sessions may not exceed browser cookie size limits of 4k bytes. If your cookie size exceeds this limit, `commitSession()` will throw an error.
293293

294-
The other downside is that you need to update the `Set-Cookie` header in every loader and action that modifies the session (this includes reading a flashed session value). With other strategies you only need to set the session cookie once, because it doesn't actually store any session data, just the key to find it elsewhere.
294+
The other downside is that you need to update the `Set-Cookie` header in every loader and action that modifies the session (this includes reading a flashed session value). With other strategies you only need to set the session cookie once, because it doesn't store any session data, just the key to find it elsewhere.
295295

296296
```ts
297297
import { createCookieSessionStorage } from "@remix-run/node"; // or cloudflare/deno
@@ -307,7 +307,7 @@ const { getSession, commitSession, destroySession } =
307307
});
308308
```
309309

310-
Note that other session implementations store a unique session ID in a cookie and use that ID to look up the session in the source of truth (in-memory, filesystem, DB, etc.). In a cookie session, the cookie _is_ the source of truth so there is no unique ID out of the box. If you need to track a unique ID in your cookie session you will need to add an ID value yourself via `session.set()`.
310+
Note that other session implementations store a unique session ID in a cookie and use that ID to look up the session in the source of truth (in-memory, filesystem, DB, etc.). In a cookie session, the cookie _is_ the source of truth so there is no unique ID out of the box. If you need to track a unique ID in your cookie session, you will need to add an ID value yourself via `session.set()`.
311311

312312
## `createMemorySessionStorage`
313313

docs/utils/unstable-create-memory-upload-handler.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ export const action = async ({
2626
};
2727
```
2828

29-
**Options:** The only options supported are `maxPartSize` and `filter` which work the same as in `unstable_createFileUploadHandler` above. This API is not recommended for anything at scale, but is a convenient utility for simple use cases and as a fallback for another handler.
29+
**Options:** The only options supported are `maxPartSize` and `filter` which work the same as in `unstable_createFileUploadHandler` above. This API is not recommended for anything at scale but is a convenient utility for simple use cases and as a fallback for another handler.

0 commit comments

Comments
 (0)