react-redux icon indicating copy to clipboard operation
react-redux copied to clipboard

Failed prop type: Calling PropTypes validators directly error

Open Orgil opened this issue 9 years ago • 20 comments

as my investigation, it happens after importing connected component from library. is it possible that validators are called once converted by babel?

Orgil avatar May 11 '17 10:05 Orgil

Please specify versions of react-redux and react you are using.

gaearon avatar May 11 '17 10:05 gaearon

react 15.5.4 redux 3.6.0 react-redux 5.0.4 On Thu, May 11, 2017 at 18:59 Dan Abramov [email protected] wrote:

Please specify versions of react-redux and react you are using.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/reactjs/react-redux/issues/696#issuecomment-300755847, or mute the thread https://github.com/notifications/unsubscribe-auth/AAeGHALPLjU0d4GmKmmlNV1gP4yOiR0-ks5r4uongaJpZM4NX1YI .

Orgil avatar May 11 '17 14:05 Orgil

Can you provide a project reproducing this?

gaearon avatar May 11 '17 15:05 gaearon

@gaearon Here are 2 repos that reproduce the issue. test-lib is packed by webpack/babel as a library, other one uses this lib.

https://github.com/Orgil/test-lib https://github.com/Orgil/test-app

Orgil avatar May 12 '17 02:05 Orgil

I'm not seeing that error pop up. Everything renders correctly and nothing comes up on the console. When are you seeing this error? Have you tried deleting your node_modules folder and reinstalling?

timdorr avatar May 12 '17 02:05 timdorr

thats weird. Just running this showing error on my end. those 2 are fresh repos i just created.

Orgil avatar May 12 '17 02:05 Orgil

btw, this might be helpful. i'm using node 6.10.3. in order to test lib repo is locally linked to app.

Orgil avatar May 12 '17 02:05 Orgil

I'm on a newer node, but that shouldn't apply since this runs in the browser. I did the same with npm link.

What browser (with version) are you using?

timdorr avatar May 12 '17 02:05 timdorr

chrome 57.0.2987.133. also on firefox 53 generate error.

Orgil avatar May 12 '17 03:05 Orgil

I'm on mac and just tried on linux it is generating same error 3 times. if i remove connect from test-lib it generates error 1 time. really confused.

Orgil avatar May 12 '17 03:05 Orgil

turns out this is prop-types issue. https://github.com/reactjs/prop-types/issues/38

Orgil avatar May 12 '17 04:05 Orgil

Well, that's upstream of us. Nothing we can do about that here. I'll make sure we stay up to date on the deps if that involves a breaking change on prop-types.

Really weird I'm not seeing the error. I'm on Chrome 58, so I should be seeing it, but I'm not.

timdorr avatar May 12 '17 13:05 timdorr

Please see https://github.com/reactjs/prop-types/issues/38.

This was a false positive caused by production version of prop-types generating a mistaken warning when development version of React is calling it.

It is fixed in [email protected].

You might need to rebuild the UMD bundle of the component that depends on prop-types to see the changes.

gaearon avatar May 12 '17 14:05 gaearon

I think this means we need another pair of react-redux releases with rebuilt UMD bundles. I’m sorry šŸ˜ž

gaearon avatar May 12 '17 16:05 gaearon

No worries, I can get that done. I'm going to look into #680/#681 before doing so, since it's a good time to roll that all together (pun intended) anyways.

And I'll do a 3.7.0 on Redux to get the Rollup-ed UMD build on there at the same time. I'll be able to get to that tonight or tomorrow. šŸ‘

timdorr avatar May 12 '17 17:05 timdorr

Always so helpful. Thank you @timdorr!

gaearon avatar May 12 '17 17:05 gaearon

Sorry about the mis-fire this weekend. I'm having a busy time at work with a big product release on the 30th (culmination of 2 years of work!) and that obviously has my focus, including weekends. We're getting close to having it all worked out, so I'll try to find some time tonight to review things and get this pushed out. Sorry for the delays!

timdorr avatar May 17 '17 15:05 timdorr

OK, 5.0.5 is out!

timdorr avatar May 18 '17 04:05 timdorr

@patialmanoj : This is a bug tracker, not a support system. For usage questions, please use Stack Overflow or Reactiflux where there are a lot more people ready to help you out - you'll probably get a better answer faster. Thanks!

That said, I don't think you're experiencing the error described in this issue. Your error says that PropTypes.Array is undefined. My guess is that you're trying to do import React, {PropTypes} from "react", but that no longer works in React 16. Instead, you need to do import PropTypes from "prop-types". See https://reactjs.org/docs/typechecking-with-proptypes.html and https://reactjs.org/blog/2017/09/26/react-v16.0.html#upgrading .

markerikson avatar Dec 09 '17 20:12 markerikson

thanks

patialmanoj avatar Dec 09 '17 20:12 patialmanoj