Fix compatibility of unit tests with react-hook-form 7.56.x#10742
Merged
Fix compatibility of unit tests with react-hook-form 7.56.x#10742
Conversation
djhi
reviewed
May 13, 2025
| // Make sure it's not a FormDataConsumer | ||
| // @ts-ignore | ||
| !Children.only(children).type !== FormDataConsumer | ||
| Children.only(children).type !== FormDataConsumer |
Contributor
There was a problem hiding this comment.
Did you try to find a way to remove the ts-ignore?
Contributor
Author
There was a problem hiding this comment.
no, this is out of scope for this PR IMO
djhi
approved these changes
May 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Upgrading react-hook-form to v7.56.x breaks some unit tests.
Failing test suites:
packages/ra-ui-materialui/src/input/ArrayInput/SimpleFormIterator.spec.tsxpackages/ra-ui-materialui/src/input/SelectArrayInput.spec.tsxpackages/ra-ui-materialui/src/input/NumberInput.spec.tsxpackages/ra-core/src/controller/input/useReferenceInputController.spec.tsxpackages/ra-ui-materialui/src/list/filter/FilterButton.spec.tsx(flaky)Solutions
SimpleFormIterator
Regression brought by #9795, somehow unseen 🤷 🤔
SelectArrayInput
Same: not sure how we did not see that...
The code of the story used by the test was wrong... 🤔
NumberInput
This one is actually a RHF regression, I've opened an issue:
react-hook-form/react-hook-form#12815
useReferenceInputController
Render count needs to be increased from 3 to 4. Fixed by simply awaiting the expected call.
FilterButton
Flaky tests.
Fixed by adding timeouts.
How To Test
yarn up react-hook-formmake test-unitAdditional Checks
masterfor a bugfix or a documentation fix, ornextfor a featureAlso, please make sure to read the contributing guidelines.