inertiajs / inertia-laravel

The Laravel adapter for Inertia.js.
https://inertiajs.com
MIT License
1.99k stars 222 forks source link

Support dot-notation in partial reloads #620

Closed lepikhinb closed 2 months ago

lepikhinb commented 2 months ago

This PR introduces support for nested props in partial requests.

router.visit(url, {
  only: ['auth.user', 'auth.refresh_token'],
})
$props = [
    'auth' => [
        // Included on partial reload
        'user' => new LazyProp(function () {
            return [
                'name' => 'Jonathan Reinink',
                'email' => 'jonathan@example.com',
            ];
        }),

        // Included on partial reload
        'refresh_token' => 'value',

        // Not included on partial reload
        'token' => 'value',
    ],

    // Not included on partial reload
    'shared' => [
        'flash' => 'value',
    ]
];

Additionally, some insignificant internal changes were made:

This would help simplify development of future improvements, including: