Support for Inertia's "first visit" aware lazy loading? #463
-
I have set up laravel-data to work with our Inertia app, but we were making use of Inertia's ability to load data on first load, but then automatically swap to lazy loading for subsequent loads. See their documentation here: https://inertiajs.com/partial-reloads#lazy-data-evaluation return Inertia::render('Users/Index', [
// ALWAYS included on first visit...
// OPTIONALLY included on partial reloads...
// ALWAYS evaluated...
'users' => User::get(),
// ALWAYS included on first visit...
// OPTIONALLY included on partial reloads...
// ONLY evaluated when needed...
'users' => fn () => User::get(),
// NEVER included on first visit...
// OPTIONALLY included on partial reloads...
// ONLY evaluated when needed...
'users' => Inertia::lazy(fn () => User::get()),
]); Note the second usage in their example which is to pass a callable instead of their This is particularly useful for loading a somewhat complex page, but then having individual components able to update and pass Am I correct in understanding that laravel-data doesn't currently support this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
We have |
Beta Was this translation helpful? Give feedback.
We have
Lazy::closure
which handles the second example, even use it in Flare.