Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Shivamyadav's avatar

Modal closes on clicking as soon on the delete button?

Modal closes on clicking as soon on the delete button? Even the request is not completed yet and resource is not deleted. After a 1 or 2 sec resource gets removed form the ui.

My Modal component used in the Users/Index.vue file and the delete functionality.

My controller delete logic.

 public function destroy(User $user)
    {
        DB::transaction(function () use ($user) {
            // store the new event log to the audits table
            ActivityService::log('updated', $user);

            // TODO: delete the uploaded user avatar (unlink)
            $user->delete();
        });
        session()->flash('success', 'User has been deleted!');

        return redirect()->route('users.index');
    }
1 like
3 replies
Shivamyadav's avatar

Don't know but as soon I click the delete button on which the laravel route gets hit. Then even the inertia router does not return on console on success or on finish the modal gets closed.

1 like
vincent15000's avatar

Don't know but ...

You don't know what you need to do ?

I suspect that there is a problem with your form, you probably have an error in the backend, but as onFinish is executed even if the action is not successful, it is executed in all cases.

Try to close the modal only if the action is successful onSuccess.

And have a look at the console and/or the network tab in the developer tools of your browser.

Please or to participate in this conversation.