Skip to content

🐞 fix #12097 Use dirty fields along with mount names for form reset with keepDirtyValues (#12097)#12211

Merged
bluebill1049 merged 1 commit intoreact-hook-form:masterfrom
rasikhq:dirty-fields-check-fix
Sep 7, 2024
Merged

🐞 fix #12097 Use dirty fields along with mount names for form reset with keepDirtyValues (#12097)#12211
bluebill1049 merged 1 commit intoreact-hook-form:masterfrom
rasikhq:dirty-fields-check-fix

Conversation

@rasikhq
Copy link
Copy Markdown
Contributor

@rasikhq rasikhq commented Aug 25, 2024

close #12097

Make sure to include dirty field names when resetting form and applying dirty values

@rasikhq rasikhq changed the title Use dirty fields along with mount names for form reset with keepDirtyValues (#12097) fix: Use dirty fields along with mount names for form reset with keepDirtyValues (#12097) Aug 25, 2024
- The logic for dirty value checking relies on mounts but array values
modified via setValue and shouldDirty didn't satisfy the logic
@rasikhq rasikhq force-pushed the dirty-fields-check-fix branch from 54ecb64 to a926460 Compare September 5, 2024 06:54
@bluebill1049
Copy link
Copy Markdown
Member

Nice! you have even included an e2e test. Thank you!

@bluebill1049 bluebill1049 changed the title fix: Use dirty fields along with mount names for form reset with keepDirtyValues (#12097) 🐞 fix #12097 Use dirty fields along with mount names for form reset with keepDirtyValues (#12097) Sep 7, 2024
@bluebill1049 bluebill1049 merged commit 851e8bb into react-hook-form:master Sep 7, 2024
oskarski pushed a commit to oskarski/react-hook-form that referenced this pull request Oct 1, 2024
…or form reset with keepDirtyValues (react-hook-form#12211)

- The logic for dirty value checking relies on mounts but array values
modified via setValue and shouldDirty didn't satisfy the logic

Co-authored-by: Rasikh Qadeer <rasikhqadeer98@gmail.com>
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.

issue: reset() and keepDirtyValues on dirty fields containing an array always resets the value

2 participants