@@ -326,6 +326,40 @@ public function test_lazy_props_are_included_in_partial_reload(): void
326
326
$ this ->assertSame ('A lazy value ' , $ page ->props ->lazy );
327
327
}
328
328
329
+ public function test_persist_props_on_partial_reload (): void
330
+ {
331
+ $ request = Request::create ('/user/123 ' , 'GET ' );
332
+ $ request ->headers ->add (['X-Inertia ' => 'true ' ]);
333
+ $ request ->headers ->add (['X-Inertia-Partial-Component ' => 'User/Edit ' ]);
334
+ $ request ->headers ->add (['X-Inertia-Partial-Data ' => 'data ' ]);
335
+
336
+ $ props = [
337
+ 'auth ' => [
338
+ 'user ' => new LazyProp (function () {
339
+ return [
340
+ 'name ' => 'Jonathan Reinink ' ,
341
+
342
+ ];
343
+ }),
344
+ 'token ' => 'value ' ,
345
+ ],
346
+ 'data ' => [
347
+ 'name ' => 'Taylor Otwell ' ,
348
+
349
+ ]
350
+ ];
351
+
352
+ $ response = new Response ('User/Edit ' , $ props , 'app ' , '123 ' , ['auth.user ' ]);
353
+ $ response = $ response ->toResponse ($ request );
354
+ $ page = $ response ->getData ();
355
+
356
+ $ this ->assertFalse (isset ($ page ->props ->auth ->token ));
357
+ $ this ->assertSame ('Jonathan Reinink ' , $ page ->props ->auth ->user ->name );
358
+ $ this ->
assertSame (
'[email protected] ' ,
$ page->
props ->
auth ->
user ->
email );
359
+ $ this ->assertSame ('Taylor Otwell ' , $ page ->props ->data ->name );
360
+ $ this ->
assertSame (
'[email protected] ' ,
$ page->
props ->
data ->
email );
361
+ }
362
+
329
363
public function test_top_level_dot_props_get_unpacked (): void
330
364
{
331
365
$ props = [
0 commit comments