Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

pedroborges
Copy link
Collaborator

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.

@pedroborges pedroborges added vue 2 Related to the vue adapter vue 3 Related to the vue 3 adapter labels Sep 21, 2024
@pedroborges pedroborges changed the title [1.x] Fix isDirty after form.defaults() call in Vue 3 [1.x] Fix isDirty after form.defaults() call in Vue Sep 21, 2024
Copy link
Contributor

@joetannenbaum joetannenbaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

@pedroborges pedroborges merged commit 48e1595 into master Sep 24, 2024
7 checks passed
@pedroborges pedroborges deleted the fix-isDirty-after-defaults branch September 24, 2024 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vue 2 Related to the vue adapter vue 3 Related to the vue 3 adapter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Form defaults() then reset() doesn't work as expected
2 participants