react-final-form icon indicating copy to clipboard operation
react-final-form copied to clipboard

isEqual is initialized by the first field registered instance

Open mjchang opened this issue 2 years ago • 0 comments

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?

[email protected] [email protected] [email protected] [email protected]

Other information

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

mjchang avatar May 20 '23 06:05 mjchang