Skip to content

Commit c457ba3

Browse files
committed
wip
1 parent c798907 commit c457ba3

20 files changed

+75
-46
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@
1111
/tests export-ignore
1212
/CHANGELOG.md export-ignore
1313
/README.md export-ignore
14+
/phpstan-macros.php export-ignore
15+
/phpstan.neon export-ignore

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"orchestra/testbench": "^8.0|^9.2|^10.0",
4040
"mockery/mockery": "^1.3.3",
4141
"phpunit/phpunit": "^10.4|^11.5",
42-
"laravel/pint": "^1.16",
42+
"laravel/pint": "^1.24",
4343
"larastan/larastan": "^3.0"
4444
},
4545
"suggest": {

src/AlwaysProp.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44

55
use Illuminate\Support\Facades\App;
66

7-
/**
8-
* A property that is always included in Inertia responses.
9-
* Bypasses partial reload filtering to ensure critical data is available.
10-
*/
117
class AlwaysProp
128
{
139
/**
1410
* The property value.
1511
*
12+
* Always included in Inertia responses, bypassing partial reload filtering.
13+
*
1614
* @var mixed
1715
*/
1816
protected $value;
1917

2018
/**
21-
* Create a new always property instance.
19+
* Create a new always property instance. Always properties are included
20+
* in every Inertia response, even during partial reloads when only
21+
* specific props are requested.
2222
*
2323
* @param mixed $value
2424
*/

src/Controller.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
class Controller
88
{
9+
/**
10+
* Handle the incoming request and render the Inertia response.
11+
* Renders the component and props defined in the route defaults.
12+
*/
913
public function __invoke(Request $request): Response
1014
{
1115
return Inertia::render(

src/DeferProp.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@
44

55
use Illuminate\Support\Facades\App;
66

7-
/**
8-
* A property that is loaded asynchronously after the initial page render.
9-
* Implements lazy loading for improved page performance.
10-
*/
117
class DeferProp implements IgnoreFirstLoad, Mergeable
128
{
139
use MergesProps;
1410

1511
/**
1612
* The callback to resolve the property.
1713
*
14+
* Loaded asynchronously after initial page render for performance.
15+
*
1816
* @var callable
1917
*/
2018
protected $callback;
@@ -27,7 +25,9 @@ class DeferProp implements IgnoreFirstLoad, Mergeable
2725
protected $group;
2826

2927
/**
30-
* Create a new deferred property instance.
28+
* Create a new deferred property instance. Deferred properties are excluded
29+
* from the initial page load and only evaluated when requested by the
30+
* frontend, improving initial page performance.
3131
*/
3232
public function __construct(callable $callback, ?string $group = null)
3333
{
@@ -36,7 +36,9 @@ public function __construct(callable $callback, ?string $group = null)
3636
}
3737

3838
/**
39-
* Get the defer group.
39+
* Get the defer group for this property. Properties with the same group
40+
* are loaded together in a single request, allowing for efficient
41+
* batching of related deferred data.
4042
*
4143
* @return string|null
4244
*/

src/Directive.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
class Directive
66
{
77
/**
8-
* Compile the "@inertia" Blade directive.
8+
* Compile the "@inertia" Blade directive. This directive renders the
9+
* Inertia root element with the page data, handling both client-side
10+
* rendering and SSR fallback scenarios.
911
*
1012
* @param string $expression
1113
*/
@@ -30,7 +32,9 @@ public static function compile($expression = ''): string
3032
}
3133

3234
/**
33-
* Compile the "@inertiaHead" Blade directive.
35+
* Compile the "@inertiaHead" Blade directive. This directive renders the
36+
* head content for SSR responses, including meta tags, title, and other
37+
* head elements from the server-side render.
3438
*
3539
* @param string $expression
3640
*/

src/EncryptHistoryMiddleware.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
class EncryptHistoryMiddleware
99
{
1010
/**
11-
* Handle the incoming request.
11+
* Handle the incoming request and enable history encryption. This middleware
12+
* enables encryption of the browser history state, providing additional
13+
* security for sensitive data in Inertia responses.
1214
*
1315
* @return \Symfony\Component\HttpFoundation\Response
1416
*/

src/LazyProp.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
use Illuminate\Support\Facades\App;
66

77
/**
8-
* A property that is excluded from initial page loads but evaluated during partial reloads.
9-
*
108
* @deprecated Use OptionalProp instead for clearer semantics.
119
*/
1210
class LazyProp implements IgnoreFirstLoad

src/MergeProp.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44

55
use Illuminate\Support\Facades\App;
66

7-
/**
8-
* A property that merges with existing client-side data during partial reloads.
9-
* Supports both shallow and deep merging strategies.
10-
*/
117
class MergeProp implements Mergeable
128
{
139
use MergesProps;
1410

1511
/**
1612
* The property value.
1713
*
14+
* Merged with existing client-side data during partial reloads.
15+
*
1816
* @var mixed
1917
*/
2018
protected $value;
2119

2220
/**
23-
* Create a new merge property instance.
21+
* Create a new merge property instance. Merge properties are combined
22+
* with existing client-side data during partial reloads instead of
23+
* completely replacing the property value.
2424
*
2525
* @param mixed $value
2626
*/

src/OptionalProp.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44

55
use Illuminate\Support\Facades\App;
66

7-
/**
8-
* A property that is only included when explicitly requested via partial reloads.
9-
* Enables on-demand evaluation for performance optimization.
10-
*/
117
class OptionalProp implements IgnoreFirstLoad
128
{
139
/**
1410
* The callback to resolve the property.
1511
*
12+
* Only included when explicitly requested via partial reloads.
13+
*
1614
* @var callable
1715
*/
1816
protected $callback;
1917

2018
/**
21-
* Create a new optional property instance.
19+
* Create a new optional property instance. Optional properties are only
20+
* included when explicitly requested via partial reloads, reducing
21+
* initial payload size and improving performance.
2222
*/
2323
public function __construct(callable $callback)
2424
{

0 commit comments

Comments
 (0)