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

disabled={false} causing dirtyField value to be incorrect when a default value is passed #348

Open
2 tasks done
RhysOnlyBetter opened this issue Feb 3, 2025 · 0 comments

Comments

@RhysOnlyBetter
Copy link

RhysOnlyBetter commented Feb 3, 2025

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

When I pass a default value to a field, and set disabled={false}, the field is set to dirty once I hit submit.

Expected behavior 🤔

The field should not be dirty.

This appears to be to do with some changes made in react-hook-form 7.54.2 (downgrading the react-hook-form version to 7.54.1 in the first codesandbox below will remove the bug), however I can't reproduce the issue using only react-hook-form alone.

Code Sandbox link: https://codesandbox.io/p/sandbox/eager-nash-xfx65h

Code Sandbox link (vanilla react-hook-form): https://codesandbox.io/p/sandbox/react-hook-form-submit-only-dirty-fields-forked-7pc7cp?workspaceId=ws_N9E86iuTTak73hgeXgKfX3

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

No branches or pull requests

1 participant