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

4.4.8 throws PropTypes validation warnings for React 14 #669

Closed
scottarivale opened this issue Apr 12, 2017 · 8 comments
Closed

4.4.8 throws PropTypes validation warnings for React 14 #669

scottarivale opened this issue Apr 12, 2017 · 8 comments

Comments

@scottarivale
Copy link

scottarivale commented Apr 12, 2017

For every component we use 'connect' in, we get the following JS warning on every render:

Warning: Failed Context Types: Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types Check the render method of `[NAME OF COMPONENT]`

Right now, each page load brings about 2000 of these warnings.

For example, using the following component throws warnings:

import React, { Component } from 'react'
import { connect } from 'react-redux'

class FeedCard extends Component {
  render() {
   return <div />
  }
}

export default connect(null, {
  updateFeedItem,
})(FeedCard)

But simply removing the 'connect' usage "fixes" the problem (although it renders the component useless):

import React, { Component } from 'react'
import { connect } from 'react-redux'

class FeedCard extends Component {
  render() {
   return <div />
  }
}

export default FeedCard

I confirmed that downgrading to 4.4.7 makes the issue go away.
We are using React 0.14.8

@timdorr
Copy link
Member

timdorr commented Apr 12, 2017

@gaearon So, is prop-types not compatible with 0.14 then? 😄

@kulakowka
Copy link

I have this problem too.
React 0.14.8 and react-redux 4.4.8.

@gaearon
Copy link
Contributor

gaearon commented Apr 12, 2017

Okay, this one is hard.. Let me think on it.

@gaearon
Copy link
Contributor

gaearon commented Apr 12, 2017

The problem is technically those warnings were introduced in React 15. And prop-types was extracted from React 15. So by migrating the library to use them you’re kind of opting into seeing those warnings.

But in this case they’re not actionable because they’re coming from React itself. 😞

gaearon added a commit to facebook/prop-types that referenced this issue Apr 12, 2017
I am looking at the stack to see if we're plausibly calling from React 0.14, and opting into the old behavior in this case.
I'm sorry for doing this.

Fixes reduxjs/react-redux#669
@gaearon
Copy link
Contributor

gaearon commented Apr 12, 2017

I'm going to try to cut prop-types-compatible 0.14.9 which is the real fix here.

@gaearon
Copy link
Contributor

gaearon commented Apr 12, 2017

Okay, react@0.14.9 and react-dom@0.14.9 are out, and they should play nice with prop-types. Other React-related packages were not updated. Let me know if it helps.

@gaearon
Copy link
Contributor

gaearon commented Apr 12, 2017

I also cut prop-types@15.5.8 which only prints the warning 3 times at most (so that even a false positive with react < 0.14.9 is less annoying).

@timdorr
Copy link
Member

timdorr commented Apr 12, 2017


Look at Dan go!

Looks like the issue is upstream with React itself, so I'm closing this one out.

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

No branches or pull requests

4 participants