Inertia/Laravel PATCH redirect also tries to update the referrer
<p>I have a Laravel/InertiaJS application where I perform Axios requests from a Vue frontend to update some models. In my case, I have a <strong>Proposal</strong> display page that also displays the <strong>Tasks</strong> related to the proposal. </p>
<p>I have a Vue subcomponent that performs an Axios call to update a specific task: </p>
<pre class="brush:php;toolbar:false;">const moveToNextStatus = (status) => {
console.log('run')
// update the status of the task using axios
axios.patch(`/data/tasks/${props.task.id}`, {
status: status
})
}</pre>
<p>This is the route it points to:</p>
<pre class="brush:php;toolbar:false;">Route::patch('/data/tasks/{task}', [\App\Http\Controllers\TaskController::class, 'update'] )->name('tasks.update');</pre>
<p>Then, in my Laravel <strong>TaskController</strong>, my update method looks like this: </p>
<pre class="brush:php;toolbar:false;">public function update (Request $request, Task $task)
{
$task->update($request->all());
return redirect()->back();
}</pre>
<p>For some reason, when Axios' request for PATCH /tasks/{task} fires, it also calls route <strong>PATCH /proposals/{proposal}</strong> and attempts to update the failed proposal. < /p>
<p>Maybe this has something to do with redirecting from child components? Can anyone help me? </p>