facebook/prop-types

Potential isRequired bug in v15.8.0 and above

paulchan14 opened this issue · 10 comments

We have been encountering the following error in our web app when using v15.8.0 or higher. We are using a micro front end-style setup, so I haven't ruled out that it may just be something with our setup - but it works fine at v15.7.2 ---

...application `appName` died in status LOADING_SOURCE_CODE: Cannot read properties of undefined (reading 'isRequired')
     at objectName.methodCall (Component.js:1:__)

At the given line, the component is using func.isRequired. We also have a usage of string.isRequired, but it crashes at the first instance. Looking through the changelog entry for v15.8.0, I don't see anything relating to the isRequired property.

For now, we're reverting to an earlier version, but please let me know if you have any ideas for the more recent versions.

Thanks

Have you tried v15.8.1? #370 might be related.

Also, what is "died in status LOADING_SOURCE_CODE" from?

You can see here: https://npm.runkit.com/prop-types that propTypes.func.isRequired is a function, as is propTypes.func.

Have you tried v15.8.1? #370 might be related.

Yes, we were on v15.8.1 when we noticed the error, then I worked backwards until it worked on v15.7.2

Also, what is "died in status LOADING_SOURCE_CODE" from?

I think that's part of our error boundary setup.

I wonder if it’s some kind of bundle splitting or duplication issue. What is the value of PropTypes?

Facing the same issue with our Gatsby based project.

Even after setting .isRequired, it becomes optional

@ankurparihar can you provide a repro repo or codesandbox?

Actually, I'm using GatsbyJS+ESLint+prop-types setup

Digging deeper into the problem, I'm getting prop-types related errors in the browser just fine, but not when running ESLint (even though I have enabled necessary rules).

Most likely it's some configuration issue in my .eslintrc, and not a problem with prop-types. I can't reproduce it on codesandbox yet.

I'll update if I find anything.

eslint isn’t supposed to generate PropTypes errors - those only come from your code actually being run, like in tests.

Oh, okay, I guess that's it, thanks for the clarification.

ping @paulgpeterson, any update?