Skip to content

Commit cd86baa

Browse files
committed
Update once-props.mdx
1 parent 948e4eb commit cd86baa

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

v2/data-props/once-props.mdx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ return Inertia::render('Settings', [
1414
]);
1515
```
1616

17-
Once the client has received this prop, subsequent requests will skip resolving the callback entirely and the prop will be excluded from the response. The client will automatically reuse the remembered value.
17+
After the client has received this prop, subsequent requests will skip resolving the callback entirely and the prop will be excluded from the response. The client will automatically reuse the remembered value.
1818

19-
Keep in mind that navigating to a page that doesn't include the once prop will break the chain. The backend will resolve the prop again when you navigate to a page that includes it.
19+
Navigating to a page without the once prop will break the chain, and the prop will be resolved again on the next page that has it.
2020

2121
## Sharing Once Props
2222

@@ -66,7 +66,7 @@ return Inertia::render('Settings', [
6666

6767
## Setting an Expiration
6868

69-
You may set an expiration time using the `until()` method. This method accepts a `DateTimeInterface`, `DateInterval` instance, or an integer number of seconds. The prop will be refreshed on a subsequent visit after the expiration time has passed.
69+
You may set an expiration time using the `until()` method. This method accepts a `DateTimeInterface`, `DateInterval`, or an integer (seconds). The prop will be refreshed on a subsequent visit after the expiration time has passed.
7070

7171
```php
7272
return Inertia::render('Dashboard', [
@@ -79,18 +79,18 @@ return Inertia::render('Dashboard', [
7979
You may assign a custom key using the `as()` method. This is useful when you want to share data across multiple pages while using different prop names.
8080

8181
```php
82-
// Checkout page
83-
return Inertia::render('Checkout', [
84-
'shippingCountries' => Inertia::once(fn () => Country::all())->as('countries'),
82+
// Team member list...
83+
return Inertia::render('Team/Index', [
84+
'memberRoles' => Inertia::once(fn () => Role::all())->as('roles'),
8585
]);
8686

87-
// Settings page
88-
return Inertia::render('Settings', [
89-
'availableCountries' => Inertia::once(fn () => Country::all())->as('countries'),
87+
// Invite form...
88+
return Inertia::render('Team/Invite', [
89+
'availableRoles' => Inertia::once(fn () => Role::all())->as('roles'),
9090
]);
9191
```
9292

93-
Both pages share the same underlying data because they use the same custom key. The prop will only be resolved once, even though the prop names differ.
93+
Both pages share the same underlying data because they use the same custom key, so the prop is only resolved for whichever page you visit first.
9494

9595
## Prefetching
9696

0 commit comments

Comments
 (0)