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.56k stars 435 forks source link

[1.x] Fix isDirty after form.defaults() call in Vue #1985

Closed pedroborges closed 2 months ago

pedroborges commented 2 months ago

When calling defaults() on a form, the isDirty state does not reset as expected. This occurs because the watcher only monitors changes to the form reactive properties, while the defaults() method modifies the default properties, which are not part of the watched form. As a result, isDirty is never recalculated and remains true.

This fix ensures that isDirty accurately reflects the form's state after resetting to defaults similarly to how the React adapter does it.

Fixes #1862.