Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/components/connectAdvanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ export default function connectAdvanced(

if (prefixUnsafeLifecycleMethods) {
// Use UNSAFE_ event name where supported
Connect.UNSAFE_componentWillReceiveProps = Connect.componentWillReceiveProps
delete Connect.componentWillReceiveProps
Connect.prototype.UNSAFE_componentWillReceiveProps = Connect.prototype.componentWillReceiveProps
delete Connect.prototype.componentWillReceiveProps
}

/* eslint-enable react/no-deprecated */
Expand All @@ -280,7 +280,9 @@ export default function connectAdvanced(
Connect.propTypes = contextTypes

if (process.env.NODE_ENV !== 'production') {
Connect.prototype.componentWillUpdate = function componentWillUpdate() {
// Use UNSAFE_ event name where supported
const eventName = prefixUnsafeLifecycleMethods ? 'UNSAFE_componentWillReceiveProps' : 'componentWillReceiveProps';
Connect.prototype[eventName] = function componentWillUpdate() {
// We are hot reloading!
if (this.version !== version) {
this.version = version
Expand Down