Skip to content

keepValueOnUnmount argument for useFieldArray #5090

@uneos-papr

Description

@uneos-papr

Currently, useFieldArray removes the corresponding field array from the form's current values before unmounting. This is an issue for more complex forms where parts of the form are only mounted temporarily, e.g. being part of a dialog, drawer, tab, collapsable, etc.

The useField functions has a dedicated argument to prevent this behavior: keepValueOnUnmounted.

It would be great if useFieldArray would accept the same argument and give the user the option to opt-out of the remove-on-unmount behavior.

Thank you for your great work <3

Edit: My current workaround is to prevent the component from unmounting using <KeepAlive>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions