Skip to content

issue: Prop type warnings and test failures after upgrading to 7.71.0 #13250

@joshkel

Description

@joshkel

Version Number

7.71.0

Codesandbox/Expo snack

https://github.com/joshkel/react-hook-form-bools

Steps to reproduce

  1. Clone the repo at https://github.com/joshkel/react-hook-form-bools.
  2. npm i
  3. npm test
    Note the error messages (both the prop types warning and the failed submission, apparently because MUI incorrectly handles the numeric prop).
  4. Then retest against React Hook Form 7.70.0:
    npm i react-hook-form@7.70.0
  5. npm test

Expected behaviour

After upgrading from React Hook Form 7.70.0 to 7.71.0, our tests started logging numerous warnings similar to the following:

Warning: Failed prop type: Invalid prop disabled of type number supplied to ForwardRef(ButtonBase), expected boolean.

Some tests also started failing; presumably some of the components that we're using don't behave correctly when given numeric rather than boolean props.

This appears to be the result of #13244 (specifically, the booleans_as_integers option). I encountered it in a Jest environment that's configured to the CommonJS versions of packages. (The ESM build of react-hook-form is apparently not run through Terser.)

What browsers are you seeing the problem on?

No response

Relevant log output

Warning: Failed prop type: Invalid prop `disabled` of type `number` supplied to `ForwardRef(ButtonBase)`, expected `boolean`.
        at ButtonBase (/Users/josh/src/test-cases/react-hook-form-bools/node_modules/@mui/material/ButtonBase/ButtonBase.js:90:59)
        at /Users/josh/src/test-cases/react-hook-form-bools/node_modules/@emotion/react/dist/emotion-element-25f9958c.browser.cjs.js:56:23
        at Button (/Users/josh/src/test-cases/react-hook-form-bools/node_modules/@mui/material/Button/Button.js:480:30)
        at form
        at onSubmit (/Users/josh/src/test-cases/react-hook-form-bools/form.test.js:6:23)

Code of Conduct

  • I agree to follow this project's Code of Conduct

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