inertia icon indicating copy to clipboard operation
inertia copied to clipboard

Revalidating isDirty when using the defaults() function.

Open felipedossantosoliveira opened this issue 1 year ago • 2 comments

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

felipedossantosoliveira avatar Dec 13 '23 13:12 felipedossantosoliveira

Wow, I need this!

arturferreto avatar Dec 13 '23 13:12 arturferreto

@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 ...

james-em avatar May 08 '24 21:05 james-em