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

Fix useFormGroup doesn't return validation errors with react-hook-form 7.53.0 #10168

Merged
merged 1 commit into from
Sep 2, 2024

Conversation

slax57
Copy link
Contributor

@slax57 slax57 commented Aug 28, 2024

Problem

With the latest version of react-hook-form (7.53.0 at the time of writing), useFormGroup no longer returns validation errors correctly.

This causes issues such as the TabbedForm Tab header not being colored in red when there is a validation error on one of the inputs inside the Tab.

Solution

An issue was opened on RHF repo to let them know about this regression: react-hook-form/react-hook-form#12217

However, it seems this issue also highlights that we may not being using the form state correctly to compute the form group state, hence we figured we may as well improve the useFormGroup hook to be compatible with all versions of RHF.

How To Test

  1. Update RHF to its latest version yarn up react-hook-form
  2. Run the test TabbedForm.spec.tsx > should set the style of any Tab button with errors on submit and make sure it passes

Additional Checks

  • The PR targets master for a bugfix, or next for a feature
  • The PR includes unit tests (if not possible, describe why) -> we can rely on existing unit tests
  • The PR includes one or several stories (if not possible, describe why) -> not necessary
  • The documentation is up to date -> no change necessary

Also, please make sure to read the contributing guidelines.

@djhi djhi added this to the 5.1.4 milestone Sep 2, 2024
@djhi djhi merged commit 4e85310 into master Sep 2, 2024
14 checks passed
@djhi djhi deleted the fix-useFormGroup-rhf-7.53.0 branch September 2, 2024 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants