-
Notifications
You must be signed in to change notification settings - Fork 506
Open
Labels
reactRelated to the react adapterRelated to the react adapter
Description
Version:
@inertiajs/react
version: 2.0.11
Describe the problem:
I have a create form in a sheet which stays mounted after submit, i manage open/close state manually for different purposes.
After Submit in onSuccess
i want to reset the form to the initial provided defaults (clear the form), but the default behavior is an overwrite of the defaults to the submitted data of the form.
This behavior makes totally sense because most of the time an edit form stays on the page and a create form redirect to the new data.
To opt out i provide a form.reset()
in the onSuccess
callback to reset the form, but the hook runs to late.
Steps to reproduce:
let form = useForm({ default: 'value'});
form.post('/some-url', {
onSuccess: (page) => form.reset();
})
michaelklopf
Metadata
Metadata
Assignees
Labels
reactRelated to the react adapterRelated to the react adapter