Skip to content

Commit 7a8d4bb

Browse files
committed
Update once-props.mdx
1 parent 31d0051 commit 7a8d4bb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

v2/data-props/once-props.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Once Props
33
---
44

5-
Some data rarely changes or is expensive to compute. Rather than resolving this data on every request, you may use _once props_. These props are remembered by the client and reused on subsequent pages that include the same prop. This makes them ideal for [shared data](/v2/data-props/shared-data).
5+
Some data rarely changes, is expensive to compute, or is simply large. Rather than including this data in every response, you may use _once props_. These props are remembered by the client and reused on subsequent pages that include the same prop. This makes them ideal for [shared data](/v2/data-props/shared-data).
66

77
## Creating Once Props
88

@@ -42,7 +42,7 @@ You may set an expiration time using the `until()` method. This method accepts a
4242

4343
```php
4444
return Inertia::render('Dashboard', [
45-
'rates' => Inertia::once(fn () => ExchangeRate::all())->until(now()->addHour()),
45+
'rates' => Inertia::once(fn () => ExchangeRate::all())->until(now()->addDay()),
4646
]);
4747
```
4848

@@ -72,7 +72,7 @@ You may share once props globally using the `Inertia::share()` method.
7272
Inertia::share('countries', Inertia::once(fn () => Country::all()));
7373
```
7474

75-
Or use the `shareOnce()` helper method.
75+
Alternatively, you may use the `shareOnce()` helper method for a cleaner syntax.
7676

7777
```php
7878
Inertia::shareOnce('countries', fn () => Country::all());
@@ -81,7 +81,7 @@ Inertia::shareOnce('countries', fn () => Country::all());
8181
You may also chain `as()`, `fresh()`, and `until()` onto this method.
8282

8383
```php
84-
Inertia::shareOnce('countries', fn () => Country::all())->until(3600);
84+
Inertia::shareOnce('countries', fn () => Country::all())->until(now()->addDay());
8585
```
8686

8787
You may also define a dedicated `shareOnce()` method in your middleware.
@@ -102,7 +102,7 @@ class HandleInertiaRequests extends Middleware
102102

103103
Once props work with [prefetching](/v2/data-props/prefetching). The client automatically includes any remembered once props in prefetched responses, so navigating to a prefetched page will already have the once props available.
104104

105-
The prefetch cache also respects once prop expiration. Prefetched pages containing an expired once prop will be invalidated.
105+
Prefetched pages containing an expired once prop will be invalidated from the cache.
106106

107107
## Combining with Other Prop Types
108108

0 commit comments

Comments
 (0)