Skip to content

issue: useFieldArray methods doesn't update the form isDirty after reseting the form #12837

@Wendystraite

Description

@Wendystraite

Version Number

7.56.4

Codesandbox/Expo snack

https://codesandbox.io/p/sandbox/rhf-fieldarray-reset-bug-kcdg5q

Steps to reproduce

Everything is also explained in the code sandbox.

  1. Clic "Reset Form" (should do nothing)
  2. Clic either "Append" or "Delete" ONCE
  3. Error: isDirty is false and should be true

Expected behaviour

After reseting a form and calling useFieldArray's append or remove methods, the form's isDirty state should be changed to true BUT is still false.

What browsers are you seeing the problem on?

No response

Relevant log output

Notes :
- useFieldArray is provided in a React Context here instead of prop drilling its values. This looks like the reason why this doesn't work.
- To reproduce this bug you MUST have some other components using useFormState (see FormDebug that is subscribed to isDirty, isValid, submitCount and isReady)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions