-
-
Notifications
You must be signed in to change notification settings - Fork 234
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
Add Defer Prop #531
Add Defer Prop #531
Conversation
It's great, waiting for its acceptance, so we can start using it immediately 👍 💯 |
# Conflicts: # src/Inertia.php
# Conflicts: # tests/ResponseFactoryTest.php
I just resolved the merge conflicts associated with this PR. Let me know if we want/need anything else. |
I'm having difficulty reproducing the failed test locally. 🤔 Anything I should try? |
It looks like the Easiest solution is to just use |
Co-authored-by: Roj Vroemen <[email protected]>
@rojtjo Thank you for getting to the bottom of that! I did not dig far enough into the error message to recognize the removal of those methods from PHPUnit. |
This will solve so many things for us. Great addition! |
I felt inspired by Livewire 3 Lazy feature which automatically fetched the data on page load. I think there's a ton of value in Inertia's current Lazy prop feature, but I think there are also scenarios where adding a Defer prop feature which automatically loads Lazy data on page load.
This works in tandem with inertiajs/inertia#1617. It works by extending the Lazy feature but also informs the front-end on page load which deferred properties should be loaded automatically. These properties will then automatically trigger a reload with those properties automatically added in the
only
attribute.This reduces the amount of front-end code required to pull this off. To add a long-running API query to be deferred, it would look like this:
These deferred properties will only ever be loaded automatically after page loads/navigations. Otherwise, they behave just the same as Lazy props.