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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

felipedossantosoliveira

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().

@arturferreto
Copy link

Wow, I need this!

@james-em
Copy link

james-em commented May 8, 2024

@reinink

This can make sense if you change your defaults to something that is equal to the current form data.

The reset() method already causes to revalidate isDirty so it really is specific to defaults(...).

Would need to be applied to all adapters though. I could help but PRs are already stacking so much so ...

jrson83 added a commit to inertiajs-revamped/inertia that referenced this pull request Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants