Skip to content

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

@RhysOnlyBetter

Description

@RhysOnlyBetter

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions