inertia-laravel
inertia-laravel copied to clipboard
Partial reload -> Lazy data evaluation with dynamic page content
Hello,
I'm considoring a project to use Inertia JS but I could not determine how to partially reload a dynamic layout.
In my scenario I would be using a page builder to store a multi dimension array (represented in json) in a field (e.g. "content"), for example (with the data "injected")
return Inertia::render('Pages/Home', [
'content' => Inertia::lazy(fn () => [
{
layout: 'collection_that_ajaxs",
page: 0,
records: [...]
},
{
layout: 'etc'
},
])
]);
Say "collection_that_ajaxs" needs to do a partial reload (where page = 1), but I don't also wish to reload everything from the "content" field. Is this possible?
A bit late, but I guess you can do this with an initial get route and a post.
But you need to configure HandleInertiaRequests, like this

Something like this
public function function_name(Request $request) { $request->validate([...]); //Check if data is correct $query = "do your stuff here..." return back()->with(['sucess' => $query]); ]); }
Then you access the data that should be flashed in the props
props.flash.success
Your best bet for now is to store a copy of the props and update them/merge them manually when the original changes
Otherwise https://github.com/inertiajs/inertia/pull/1247 would solve this
Hey there,
We're closing this issue because it's inactive, already solved, old or not relevant anymore. Feel free to open up a new issue if you're still experiencing this problem.