Skip to content

Commit 4be6289

Browse files
committed
introduce the concept of ignore first load
1 parent 8edbd02 commit 4be6289

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

src/DeferProp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Illuminate\Support\Facades\App;
66

7-
class DeferProp
7+
class DeferProp implements IgnoreFirstLoad
88
{
99
protected $callback;
1010

src/IgnoreFirstLoad.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace Inertia;
4+
5+
interface IgnoreFirstLoad
6+
{
7+
//
8+
}

src/LazyProp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Illuminate\Support\Facades\App;
66

7-
class LazyProp
7+
class LazyProp implements IgnoreFirstLoad
88
{
99
protected $callback;
1010

src/OptionalProp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Illuminate\Support\Facades\App;
66

7-
class OptionalProp
7+
class OptionalProp implements IgnoreFirstLoad
88
{
99
protected $callback;
1010

src/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function resolveProperties(Request $request, array $props): array
114114

115115
if (! $isPartial) {
116116
$props = array_filter($this->props, static function ($prop) {
117-
return ! ($prop instanceof OptionalProp) && ! ($prop instanceof LazyProp) && ! ($prop instanceof DeferProp);
117+
return ! ($prop instanceof IgnoreFirstLoad);
118118
});
119119
}
120120

0 commit comments

Comments
 (0)