Add support for inertia deferred props #939
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello 👋
I've drafted up an initial version of support for inertia v2 deferred props.
Usage looks like this:
I'm not really happy with the implementation, since the concept of deferred props is technically not related to lazy properties, but the implementation is basically copied 1:1. On the other hand, this kind of makes sense, since the effects of lazy and deferred properties are very similar.
My other approach would've been to basically copy the structure of the
abstract Lazy
,AutoLazy
&InertiaLazy
classes, but this would've required a bunch more changes.However, I still don't really like how I've done it here, but I don't think this can be done a lot better without larger refactoring. Maybe a bigger refactoring even makes sense, since merging props should also be implemented.
I'm definitely open for any suggestions!
Best,
Matthias