You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Comma-separated list of non-expired [once prop](/v2/data-props/once-props) keys already loaded on the client. The server will skip resolving these props unless explicitly requested via a partial reload or force refreshed server-side.
148
+
</ParamField>
149
+
146
150
## Response Headers
147
151
148
152
The following headers should be sent by your server-side adapter in Inertia responses. If you're using an official server-side adapter, these are handled automatically.
@@ -211,6 +215,10 @@ Inertia shares data between the server and client via a page object. This object
211
215
Configuration for client-side [lazy loading of props](/v2/data-props/deferred-props).
212
216
</ParamField>
213
217
218
+
<ParamFieldbody="onceProps"type="object">
219
+
Configuration for [once props](/v2/data-props/once-props) that should only be resolved once and reused on subsequent pages. Each entry maps a key to an object containing the `prop` name and optional `expiresAt` timestamp (in milliseconds).
220
+
</ParamField>
221
+
214
222
On standard full page visits, the page object is JSON encoded into the `data-page` attribute in the root `<div>`. On Inertia visits (as indicated by the presence of the `X-Inertia` header), the page object is returned as the JSON payload.
215
223
216
224
### Basic Page Object
@@ -360,6 +368,78 @@ When using [Infinite scroll](/v2/data-props/infinite-scroll), the page object in
360
368
}
361
369
```
362
370
371
+
### Page Object with Once Props
372
+
373
+
When using [once props](/v2/data-props/once-props), the page object includes an `onceProps` configuration. Each entry maps a key to the prop name and an optional expiration timestamp.
374
+
375
+
```json
376
+
{
377
+
"component": "Billing/Plans",
378
+
"props": {
379
+
"errors": {},
380
+
"plans": [
381
+
{
382
+
"id": 1,
383
+
"name": "Basic"
384
+
},
385
+
{
386
+
"id": 2,
387
+
"name": "Pro"
388
+
}
389
+
]
390
+
},
391
+
"url": "/billing/plans",
392
+
"version": "6b16b94d7c51cbe5b1fa42aac98241d5",
393
+
"clearHistory": false,
394
+
"encryptHistory": false,
395
+
"onceProps": {
396
+
"plans": {
397
+
"prop": "plans",
398
+
"expiresAt": null
399
+
}
400
+
}
401
+
}
402
+
```
403
+
404
+
When navigating to a subsequent page that includes the same once prop, the client sends the loaded keys in the `X-Inertia-Page-Once-Props` header. The server skips resolving these props and excludes them from the response. The client reuses the previously loaded values.
Note that `plans` is included in `onceProps` but not in `props` since it was already loaded on the client. The `onceProps` key identifies the once prop across pages, while `prop` specifies the actual prop name. These may differ when using [custom keys](/v2/data-props/once-props#custom-keys).
442
+
363
443
## Asset Versioning
364
444
365
445
One common challenge with single-page apps is refreshing site assets when they've been changed. Inertia makes this easy by optionally tracking the current version of the site's assets. In the event that an asset changes, Inertia will automatically make a full-page visit instead of an XHR visit.
0 commit comments