Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isEqual is initialized by the first field registered instance #1032

Open
mjchang opened this issue May 20, 2023 · 0 comments · May be fixed by final-form/final-form#480
Open

isEqual is initialized by the first field registered instance #1032

mjchang opened this issue May 20, 2023 · 0 comments · May be fixed by final-form/final-form#480

Comments

@mjchang
Copy link

mjchang commented May 20, 2023

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 mjchang changed the title isEqual is initialized by the first field registered isEqual is initialized by the first field registered instance May 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant