Skip to content

Conversation

pascalbaljet
Copy link
Member

@pascalbaljet pascalbaljet commented Sep 23, 2025

This PR introduces a loadDeferredProps() method on the AssertableInertia class, similar to testing partial reloads (see PR #738).

Inertia::render('Index', [
    'foo' => 'bar',
    'deferred1' => Inertia::defer(fn () => 'baz'),
    'deferred2' => Inertia::defer(fn () => 'qux', 'custom'),
    'deferred3' => Inertia::defer(fn () => 'quux', 'custom'),
]);

//

$response->assertInertia(function (AssertableInertia $inertia) {
    $inertia->where('foo', 'bar');
    $inertia->missing('deferred1');
    $inertia->missing('deferred2');
    $inertia->missing('deferred3');

    $inertia->loadDeferredProps(function (AssertableInertia $inertia) {
        $inertia->where('deferred1', 'baz');
        $inertia->where('deferred2', 'qux');
        $inertia->where('deferred3', 'quux');
    });
});

You can also load a specific group.

$inertia->loadDeferredProps('default', function (AssertableInertia $inertia) {
    //
});

Or multiple.

$inertia->loadDeferredProps(['default', 'custom'], function (AssertableInertia $inertia) {
    //
});

@pascalbaljet pascalbaljet marked this pull request as ready for review September 23, 2025 21:27
@pascalbaljet pascalbaljet merged commit a08aea5 into 2.x Sep 24, 2025
38 checks passed
@pascalbaljet pascalbaljet deleted the test-deferred-props branch September 26, 2025 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant