-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
Don't call componentDidUpdate() in shallow renderer #10372
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with this change. Seems safer.
typeof this._instance.componentDidUpdate === 'function' | ||
) { | ||
this._instance.componentDidUpdate(oldProps, oldState); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Might be nice to leave a placeholder comment referencing why we decided not to call cDU
We did this for initial compatibility with Stack, but this behavior seems undesirable because it's inconsistent with
componentDidMount
.Past discussion in #9426 (comment) seems to uncover Enzyme depends on it. Can we verify this is the case? I ran Jest internally and did not see issues caused by this change. Since Enzyme needs to adapt to other 16 changes, we might as well make this one.