We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
^2.0.0-beta.3
It seems that deferred properties do not work correctly when combined with partial reloads.
For example, in the backend, you might define a response with deferred properties like this:
return Inertia::render('ExamplePage', [ 'prop1' => Inertia::defer(fn () => 'Deferred Value 1'), 'prop2' => Inertia::defer(fn () => 'Deferred Value 2'), ]);
Then, from the frontend, you trigger a partial reload for a single property using:
return router.visit(route(route().current(), { only: ['prop1'] }), { preserveScroll: true, preserveState: true, });
Both prop1 and prop2 are loaded.
It would be ideal to allow combining defer and lazy methods. For example:
Inertia::defer(fn () => $hoursService->getUsedHours())->lazy() //or Inertia::lazy(fn () => $hoursService->getUsedHours())->defer()
Install Inertia v2:
@inertiajs/vue3
Set up a controller with deferred properties:
Inertia::render
Trigger a partial reload from the frontend:
router.visit(route(route().current(), { only: ['prop1'] }), { preserveScroll: true, preserveState: true, });
Observe the behavior:
prop1
prop2
only: ['prop1']
Optional - Test with Inertia::lazy:
Inertia::lazy
Inertia::lazy()
defer
The text was updated successfully, but these errors were encountered:
In your examples, you are passing the { only: ['prop1'] } argument to the route() function, instead of the router.visit() options
{ only: ['prop1'] }
route()
router.visit()
It should be:
router.visit(route(route().current()), { only: ['prop1'], preserveScroll: true, preserveState: true, });
Hope this helps
Sorry, something went wrong.
No branches or pull requests
Version:
^2.0.0-beta.3
Describe the problem:
It seems that deferred properties do not work correctly when combined with partial reloads.
For example, in the backend, you might define a response with deferred properties like this:
Then, from the frontend, you trigger a partial reload for a single property using:
Both prop1 and prop2 are loaded.
It would be ideal to allow combining defer and lazy methods. For example:
Steps to reproduce:
Install Inertia v2:
@inertiajs/vue3
version^2.0.0-beta.3
.Set up a controller with deferred properties:
Inertia::render
with deferred properties:Trigger a partial reload from the frontend:
Observe the behavior:
prop1
andprop2
are loaded, even though the request specifiesonly: ['prop1']
.Optional - Test with
Inertia::lazy
:Inertia::lazy()
and verify thatdefer
no longer works when combined.The text was updated successfully, but these errors were encountered: