-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
v7.12.0 update throw is missing in props validation (react/prop-types) #2094
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
Comments
In this case, your |
Similar issue when we have Ref element like this:
Update: Also other standard methods like Array.findIndex, Array.length throw this error. |
Now that is a bug - accessing things chained off of cc @alexzherdev |
As I said, I tried to change to PropTypes.shape propTypes = {
actions: PropTypes.shape({
doSomething: PropTypes.func.isRequired,
}).isRequired,
}; Error still the same |
I'm having a similar issue: shouldComponentUpdate(nextProps) {
if (this.props.search !== nextProps.search) {
let query = nextProps.query;
let result = nextProps.list.filter(item => {
return (item.name.toLowerCase().includes(query.trim().toLowerCase()));
});
this.setState({ result });
return true;
}
} And am getting the following errors since 7.12
|
after update 7.12
|
Same problem |
Hi, componentDidUpdate() {
...
const {
first_organization,
second_organization,
} = this.state;
...
Thank you for your work. |
Facing same issue. |
Is prop validation cascading down an object new behavior? For code like this just started failing as well. The "obj" is in props validation. ('a' is missing in props validation react/prop-types). From what I have noticed it seems to only throw on the lifecycle functions. I use children of the object in the render and it doesn't error.
` It's also checking state it seems now. Again only noticed it on lifecycle functions
` |
Thanks everybody; if you have different code that's erroring, please post it. If you're just experiencing the same issue, please add an emoji reaction to the original post. This is an accepted bug; we just need someone to work on it. |
Looks like one of the problems is from #1946 via the change in the logic for |
@ljharb When will this fix be released to NPM? |
v7.12.1 is released. |
Stupid question: if the prop is not required, why does this rule require us to define it? Just really annoyed that this minor change broke my build and made me go through all of my files by hand. |
@ajfarkas "required" means that element creators can omit it at runtime; it doesn't mean that when provided it doesn't have a contract to adhere to. |
Uh oh!
There was an error while loading. Please reload this page.
After updating to v7.12.0 appeared strange validation errors.
I have this propTypes:
and this code:
And then I have eslint error: 'doSomething' is missing in props validation react/prop-type
on the line in componentWillReceiveProps. But the line in componentWillUnmount is ok.
Strange that it says "'doSomething' is missing" and not "'actions.doSomething' is missing"
I tried to change "PropTypes.object" to "PropTypes.shape", still the same.
Error disappears if I change name "componentWillReceiveProps" to something else.
If I add propType "doSomething: PropTypes.func.isRequired" error disappears too but it doesn't make sense.
The text was updated successfully, but these errors were encountered: