@@ -249,6 +249,36 @@ public function test_lazy_props_can_be_evaluated(): void
249249 $ this ->assertTrue ($ called );
250250 }
251251
252+ public function test_lazy_props_can_be_evaluated_when_only_is_array (): void
253+ {
254+ $ response = $ this ->makeMockRequest (
255+ Inertia::render ('foo ' , [
256+ 'foo ' => 'bar ' ,
257+ 'lazy1 ' => Inertia::optional (fn () => 'baz ' ),
258+ 'lazy2 ' => Inertia::optional (fn () => 'qux ' ),
259+ ])
260+ );
261+
262+ $ called = false ;
263+
264+ $ response ->assertInertia (function ($ inertia ) use (&$ called ) {
265+ $ inertia ->where ('foo ' , 'bar ' );
266+ $ inertia ->missing ('lazy1 ' );
267+ $ inertia ->missing ('lazy2 ' );
268+
269+ $ result = $ inertia ->reloadOnly (['lazy1 ' ], function ($ inertia ) use (&$ called ) {
270+ $ inertia ->missing ('foo ' );
271+ $ inertia ->where ('lazy1 ' , 'baz ' );
272+ $ inertia ->missing ('lazy2 ' );
273+ $ called = true ;
274+ });
275+
276+ $ this ->assertSame ($ result , $ inertia );
277+ });
278+
279+ $ this ->assertTrue ($ called );
280+ }
281+
252282 public function test_lazy_props_can_be_evaluated_with_except (): void
253283 {
254284 $ response = $ this ->makeMockRequest (
@@ -277,6 +307,34 @@ public function test_lazy_props_can_be_evaluated_with_except(): void
277307 $ this ->assertTrue ($ called );
278308 }
279309
310+ public function test_lazy_props_can_be_evaluated_with_except_when_except_is_array (): void
311+ {
312+ $ response = $ this ->makeMockRequest (
313+ Inertia::render ('foo ' , [
314+ 'foo ' => 'bar ' ,
315+ 'lazy1 ' => Inertia::lazy (fn () => 'baz ' ),
316+ 'lazy2 ' => Inertia::lazy (fn () => 'qux ' ),
317+ ])
318+ );
319+
320+ $ called = false ;
321+
322+ $ response ->assertInertia (function ($ inertia ) use (&$ called ) {
323+ $ inertia ->where ('foo ' , 'bar ' );
324+ $ inertia ->missing ('lazy1 ' );
325+ $ inertia ->missing ('lazy2 ' );
326+
327+ $ inertia ->reloadExcept (['lazy1 ' ], function ($ inertia ) use (&$ called ) {
328+ $ inertia ->where ('foo ' , 'bar ' );
329+ $ inertia ->missing ('lazy1 ' );
330+ $ inertia ->where ('lazy2 ' , 'qux ' );
331+ $ called = true ;
332+ });
333+ });
334+
335+ $ this ->assertTrue ($ called );
336+ }
337+
280338 public function test_assert_against_deferred_props (): void
281339 {
282340 $ response = $ this ->makeMockRequest (
0 commit comments