`withFragment()` causes Inertia visit to return 409 Conflict
Inertia adapter(s) affected
- React
- Vue 3
- Svelte
- Not Applicable
JS package version
3.6.0
Backend stack (optional)
Laravel 13.26 PHP 8.5
Describe the problem
When performing an Inertia visit that calls a Laravel controller method containing ->withFragment(...), the request completes successfully on the server but the browser receives a 409 Conflict response.
This prevents any deferred functions registered with defer() from being executed, since the request is treated as a conflict. Using ->always() on the deferred function makes it run, but this defeats the purpose of deferred execution.
Example:
public function updateThat(Request $request)
{
// do things...
defer(function() {
// do deferred things...
}); // <- never called due to 409 Conflict
return back()->withFragment('my-tab'); // <- always 409 Conflict
}Expected behavior
The Inertia visit should complete successfully when using withFragment(), and deferred functions should be executed normally.
Actual behavior
The response is returned as 409 Conflict, causing the deferred function to be skipped unless ->always() is used.
Steps to reproduce
- Create a Laravel controller method handled through an Inertia visit.
- Register a deferred function using
defer(). - Return a redirect using
back()->withFragment('my-tab'). - Trigger the controller method through an Inertia request.
- Observe that the browser receives a 409 Conflict response.
- Observe that the deferred function is never executed.
- Replace
defer()withdefer(...)->always()and observe that the function is executed.
Source: inertiajs/inertia