inertiajs / inertia

Inertia.js lets you quickly build modern single-page React, Vue and Svelte apps using classic server-side routing and controllers.
https://inertiajs.com
MIT License
6.03k stars 405 forks source link

Revalidating isDirty when using the defaults() function. #1781

Closed felipedossantosoliveira closed 5 months ago

felipedossantosoliveira commented 5 months ago

When the form.defaults() function is used, it doesn't update the form.isDirty(), as it is revalidated by a watcher, which is only triggered after a change in the form. I mistakenly called the same validation trigger used in the watcher to revalidate the isDirty() within the defaults() function. This was an error because isDirty() returns false if a field is cleared and then rewritten with the same value after using defaults().