Skip to content

Commit aad1e9d

Browse files
authored
Merge pull request #214 from skryukov/docs/fixes-from-upstream
Docs: fixes from upstream
2 parents 4ceb8c3 + 78dfb31 commit aad1e9d

File tree

6 files changed

+19
-15
lines changed

6 files changed

+19
-15
lines changed

docs/guide/error-handling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ class ApplicationController < ActionController::Base
2323

2424
status = ActionDispatch::ExceptionWrapper.new(nil, exception).status_code
2525

26-
render inertia: 'Error', props: { status: }, status:
26+
render inertia: 'ErrorPage', props: { status: }, status:
2727
end
2828
end
2929
```
3030

31-
You may have noticed we're returning an `Error` page component in the example above. You'll need to actually create this component, which will serve as the generic error page for your application. Here's an example error component you can use as a starting point.
31+
You may have noticed we're returning an `ErrorPage` page component in the example above. You'll need to actually create this component, which will serve as the generic error page for your application. Here's an example error component you can use as a starting point.
3232

3333
:::tabs key:frameworks
3434
== Vue

docs/guide/manual-visits.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -710,23 +710,23 @@ The `only` option allows you to request a subset of the props (data) from the se
710710
```js
711711
import { router } from '@inertiajs/vue3'
712712

713-
router.visit('/users', { data: { search: 'John' }, only: ['users'] })
713+
router.get('/users', { search: 'John' }, { only: ['users'] })
714714
```
715715

716716
== React
717717

718718
```js
719719
import { router } from '@inertiajs/react'
720720

721-
router.visit('/users', { data: { search: 'John' }, only: ['users'] })
721+
router.get('/users', { search: 'John' }, { only: ['users'] })
722722
```
723723

724724
== Svelte 4|Svelte 5
725725

726726
```js
727727
import { router } from '@inertiajs/svelte'
728728

729-
router.visit('/users', { data: { search: 'John' }, only: ['users'] })
729+
router.get('/users', { search: 'John' }, { only: ['users'] })
730730
```
731731

732732
:::

docs/guide/responses.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,4 +235,4 @@ You can find the default templates in the gem's source code:
235235

236236
To enable client-side history navigation, all Inertia server responses are stored in the browser's history state. However, keep in mind that some browsers impose a size limit on how much data can be saved within the history state.
237237

238-
For example, [Firefox](https://developer.mozilla.org/en-US/docs/Web/API/History/pushState) has a size limit of 640k characters and throws a `NS_ERROR_ILLEGAL_VALUE` error if you exceed this limit. Typically, this is much more data than you'll ever practically need when building applications.
238+
For example, [Firefox](https://developer.mozilla.org/en-US/docs/Web/API/History/pushState) has a size limit of 16 MiB and throws a `NS_ERROR_ILLEGAL_VALUE` error if you exceed this limit. Typically, this is much more data than you'll ever practically need when building applications.

docs/guide/scroll-management.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ If your app doesn't use document body scrolling, but instead has scrollable elem
149149
In these situations, you must tell Inertia which scrollable elements to manage by adding the `scroll-region` attribute to the element.
150150

151151
```html
152-
<div class="overflow-y-auto" scroll-region>
152+
<div class="overflow-y-auto" scroll-region="">
153153
<!-- Your page content -->
154154
</div>
155155
```

docs/guide/the-protocol.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Content-Type: text/html; charset=utf-8
2626
</head>
2727
<body>
2828
29-
<div id="app" data-page='{"component":"Event","props":{"event":{"id":80,"title":"Birthday party","start_date":"2019-06-02","description":"Come out and celebrate Jonathan&apos;s 36th birthday party!"}},"url":"/events/80","version":"c32b8e4965f418ad16eaebba1d4e960f"}'></div>
29+
<div id="app" data-page='{"component":"Event","props":{"errors":{},"event":{"id":80,"title":"Birthday party","start_date":"2019-06-02","description":"Come out and celebrate Jonathan&apos;s 36th birthday party!"}},"url":"/events/80","version":"c32b8e4965f418ad16eaebba1d4e960f"}'></div>
3030
3131
</body>
3232
</html>
@@ -58,6 +58,7 @@ X-Inertia: true
5858
{
5959
"component": "Event",
6060
"props": {
61+
"errors": {},
6162
"event": {
6263
"id": 80,
6364
"title": "Birthday party",
@@ -77,7 +78,7 @@ X-Inertia: true
7778
Inertia shares data between the server and client via a page object. This object includes the necessary information required to render the page component, update the browser's history state, and track the site's asset version. The page object includes the following four properties:
7879

7980
1. `component`: The name of the JavaScript page component.
80-
2. `props`: The page props (data).
81+
2. `props`: The page props. Contains all of the page data along with an `errors` object (defaults to `{}` if there are no errors).
8182
3. `url`: The page URL.
8283
4. `version`: The current asset version.
8384
5. `encryptHistory`: Whether or not to encrypt the current page's history state.
@@ -116,11 +117,13 @@ X-Inertia-Location: http://example.com/events/80
116117

117118
When making Inertia requests, the partial reload option allows you to request a subset of the props (data) from the server on subsequent visits to the same page component. This can be a helpful performance optimization if it's acceptable that some page data becomes stale.
118119

119-
When a partial reload request is made, Inertia includes two additional headers with the request: `X-Inertia-Partial-Data` and `X-Inertia-Partial-Component`.
120+
When a partial reload request is made, Inertia includes the `X-Inertia-Partial-Component` header and may include `X-Inertia-Partial-Data` and/or `X-Inertia-Partial-Except` headers with the request.
120121

121122
The `X-Inertia-Partial-Data` header is a comma separated list of the desired props (data) keys that should be returned.
122123

123-
The `X-Inertia-Partial-Component` header includes the name of the component that is being partially reloaded. This is necessary, since partial reloads only work for requests made to the same page component. If the final destination is different for some reason (eg. the user was logged out and is now on the login page), then no partial reloading will occur.
124+
The `X-Inertia-Partial-Except` header is a comma separated list of the props (data) keys that should not be returned. When only the `X-Inertia-Partial-Except` header is included, all props (data) except those listed will be sent. If both `X-Inertia-Partial-Data` and `X-Inertia-Partial-Except` headers are included, the `X-Inertia-Partial-Except` header will take precedence.
125+
126+
The `X-Inertia-Partial-Component` header includes the name of the component that is being partially reloaded. This is necessary, since partial reloads only work for requests made to the same page component. If the final destination is different for some reason (e.g. the user was logged out and is now on the login page), then no partial reloading will occur.
124127

125128
```http
126129
REQUEST
@@ -141,7 +144,8 @@ Content-Type: application/json
141144
"props": {
142145
"auth": {...}, // NOT included
143146
"categories": [...], // NOT included
144-
"events": [...] // included
147+
"events": [...], // included
148+
"errors": {} // always included
145149
},
146150
"url": "/events/80",
147151
"version": "c32b8e4965f418ad16eaebba1d4e960f"

docs/guide/validation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,17 @@ export default function Edit() {
107107

108108
return (
109109
<form onSubmit={handleSubmit}>
110-
<label for="first_name">First name:</label>
110+
<label htmlFor="first_name">First name:</label>
111111
<input
112112
id="first_name"
113113
value={values.first_name}
114114
onChange={handleChange}
115115
/>
116116
{errors.first_name && <div>{errors.first_name}</div>}
117-
<label for="last_name">Last name:</label>
117+
<label htmlFor="last_name">Last name:</label>
118118
<input id="last_name" value={values.last_name} onChange={handleChange} />
119119
{errors.last_name && <div>{errors.last_name}</div>}
120-
<label for="email">Email:</label>
120+
<label htmlFor="email">Email:</label>
121121
<input id="email" value={values.email} onChange={handleChange} />
122122
{errors.email && <div>{errors.email}</div>}
123123
<button type="submit">Submit</button>

0 commit comments

Comments
 (0)