Skip to content

isEqual is initialized by the first field registered instance #1032

@mjchang

Description

@mjchang

Are you submitting a bug report or a feature request?

Bug report

What is the current behavior?

I have a use case where I am using multiple Field and useField for the same field (same name). Let's call this field A. This is done for performance reasons as I need to conditionally show other fields based on the value of field A. I want to specify a custom isEqual function. However, this doesn't work as the first instance of field A registered defines the isEqual function.

I could define the isEqual function in every instance of field A's Field and useField but this seems excessive and redundant as I would need to do this to every field in this large form in every of Field and useField

What is the expected behavior?

I should be able to define isEqual in any Field and useField instance and it should be applied.

Sandbox Link

https://codesandbox.io/s/staging-voice-8e4nyr?file=/index.js

What's your environment?

react-final-form@6.5.9
final-form@4.20.9
react@17.0.2
node@18.12.1

Other information

The root cause of this is because the first instance of field A registered defines the isEqual function..

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