You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Was looking at the on-going async-requests branch and though I'd chime in with some questions/feedback if you'd indulge me.
Prelude
Currently Inertia does not allow fined grained partial requests on the client side because it only merges the first level prop objects back into the current Page props object.
And on the client end users would expect only the first_name and last_name properties of the first "friends" of the authenticated user to be merged back to the existing Inertia Page object.
However, currently the retrieved auth object would completely override the existing one, thus removing any other existing properties.
I am aware this has previously been attempted with #1877 then reverted by #1895. But with the on-going rewrite it might a good time to tackle this.
Suggestion
Allow for nested props merging. Many existing JavaScript libraries could be used here.
Or here's an example implementation inspired by Laravel's `Illuminate\Collections\Arr` helper:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi there @joetannenbaum 👋
Was looking at the on-going async-requests branch and though I'd chime in with some questions/feedback if you'd indulge me.
Prelude
Currently Inertia does not allow fined grained partial requests on the client side because it only merges the first level prop objects back into the current Page props object.
response.ts
This prevents, as an example, retrieving only a very specific prop subset, like a given nested property.
In the example above, the server would return the following props:
And on the client end users would expect only the
first_name
andlast_name
properties of the first "friends" of the authenticated user to be merged back to the existing InertiaPage
object.However, currently the retrieved
auth
object would completely override the existing one, thus removing any other existing properties.I am aware this has previously been attempted with #1877 then reverted by #1895. But with the on-going rewrite it might a good time to tackle this.
Suggestion
Allow for nested props merging. Many existing JavaScript libraries could be used here.
Or here's an example implementation inspired by Laravel's `Illuminate\Collections\Arr` helper:
Beta Was this translation helpful? Give feedback.
All reactions