Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support dot-notation in partial reloads #620

Merged

Conversation

lepikhinb
Copy link
Contributor

@lepikhinb lepikhinb commented May 12, 2024

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:

  • Extract methods:
    • resolveProperties
    • resolveArrayableProperties
    • resolveOnly
  • Introduce Header enum

This would help simplify development of future improvements, including:

  • Partial except visits
  • Deferred properties
  • Persistent properties

@taylorotwell taylorotwell marked this pull request as ready for review May 13, 2024 01:59
@taylorotwell taylorotwell merged commit de6b005 into inertiajs:1.x May 13, 2024
26 checks passed
thecrypticace added a commit that referenced this pull request Jun 13, 2024
@reinink reinink changed the title Support dot notation in partial requests Support dot notation in partial reloads Jun 13, 2024
@reinink reinink changed the title Support dot notation in partial reloads Support dot-notation in partial reloads Jun 13, 2024
reinink added a commit that referenced this pull request Jun 13, 2024
* Revert "Support dot notation in partial requests (#620)"

This reverts commit de6b005.

* Fix formatting

* Add addition tests

* Update CHANGELOG.md

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
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.

2 participants