inertiaui / modal

With Inertia Modal, you can easily open any route in a Modal or Slideover without having to change anything about your existing routes or controllers.
https://inertiaui.com/inertia-modal/docs
MIT License
95 stars 9 forks source link

`modalRef` usage in `onSuccess` after `useForm` #61

Open JamesFreeman opened 2 days ago

JamesFreeman commented 2 days ago

I'm having an issue where I can't close the modal after a successful useForm request:

const modalRef = ref(null);

const closeModal = () => {
    modalRef.value.close();
};

const submitForm = () => {
    form.post(route('admin.menu.store'), {
        onSuccess: () => {
            closeModal();
            form.clearErrors();
        },
    });

The page redirects, and i get the following error with the modal still active:

Screenshot 2024-11-29 at 10 19 44

I have upgraded my version to 0.13.1 to get the modalRef fixes.