Skip to content

Difficult to track down the source of a boolean prop warning #11083

@erikras

Description

@erikras

Do you want to request a feature or report a bug?

More of a DX issue, I think. Certainly a frustration in my upgrade. I would not have submitted, but @gaearon told me thrice to do so.

What is the current behavior?

My build works, but is strewn with warnings that I would like to fix. Warnings like:

Warning: Received `false` for non-boolean attribute `dirty`. If this is expected, cast the value to a string.
  in div
  in Unknown (created by Form(Component))
  in Form(Component) (created by Connect(Form(Component)))
  in Connect(Form(Component)) (created by ReduxForm)
  in ReduxForm
  in Provider

My library provides a HOC that provides boolean props. At first, I was concerned that React 16 would no longer allow this, but I think the problem is that one of my tests is carelessly leaking my props all the way into a <div/>. I even created the dumbest HOC ever to test if a HOC could pass a boolean prop, and it seems like it can.

However, from that "stacktrace" (component-trace?), it is not even remotely clear which of my 1630 tests is causing the warning. In previous versions, it would show me the exact stacktrace, with file names and line numbers, that generated the error.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

React 16.0.0, yes worked with previous.


Additionally, I have several tests that need to throw errors to alert library users that they are doing something wrong, but my test logs are now full of bright red:

Consider adding an error boundary to your tree to customize error handling behavior.
You can learn more about error boundaries at https://fb.me/react-error-boundaries.

Is that just a new fact of life for library developers, or can I catch those in my test somehow?


All this can be replicated with the current master branch of redux-form.

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