@@ -5,8 +5,6 @@ import { Component, PropTypes, createElement } from 'react'
55import Subscription from '../utils/Subscription'
66import storeShape from '../utils/storeShape'
77
8-
9- let defaultReact15CompatibilityMode = true
108let hotReloadingVersion = 0
119export default function connectAdvanced (
1210 /*
@@ -37,9 +35,6 @@ export default function connectAdvanced(
3735 // probably overridden by wrapper functions such as connect()
3836 methodName = 'connectAdvanced' ,
3937
40- // temporary compatibility setting for React 15. See Connect constructor for details
41- react15CompatibilityMode = undefined ,
42-
4338 // if defined, the name of the property passed to the wrapped element indicating the number of
4439 // calls to render. useful for watching in react devtools for unnecessary re-renders.
4540 renderCountProp = undefined ,
@@ -63,7 +58,6 @@ export default function connectAdvanced(
6358 const contextTypes = {
6459 [ storeKey ] : storeShape ,
6560 [ subscriptionKey ] : PropTypes . instanceOf ( Subscription ) ,
66- react15CompatibilityMode : PropTypes . bool ,
6761 }
6862 const childContextTypes = {
6963 [ subscriptionKey ] : PropTypes . instanceOf ( Subscription )
@@ -103,18 +97,7 @@ export default function connectAdvanced(
10397 this . state = { }
10498 this . renderCount = 0
10599 this . store = this . props [ storeKey ] || this . context [ storeKey ]
106-
107- // react15CompatibilityMode controls whether the subscription system is used. This is for
108- // https://github.com/reactjs/react-redux/issues/525 and should be removed completely when
109- // react-redux's dependency on react is bumped to mimimum v16, which is expected to include
110- // PR https://github.com/facebook/react/pull/8204 which fixes the issue.
111- const compatMode = [
112- react15CompatibilityMode ,
113- props . react15CompatibilityMode ,
114- context . react15CompatibilityMode ,
115- defaultReact15CompatibilityMode
116- ] . find ( cm => cm !== undefined && cm !== null )
117- this . parentSub = compatMode ? null : props [ subscriptionKey ] || context [ subscriptionKey ]
100+ this . parentSub = props [ subscriptionKey ] || context [ subscriptionKey ]
118101
119102 this . setWrappedInstance = this . setWrappedInstance . bind ( this )
120103
@@ -209,7 +192,6 @@ export default function connectAdvanced(
209192 initSubscription ( ) {
210193 if ( shouldHandleStateChanges ) {
211194 const subscription = this . subscription = new Subscription ( this . store , this . parentSub )
212- const notifyNestedSubs = subscription . notifyNestedSubs . bind ( subscription )
213195 const dummyState = { }
214196
215197 subscription . onStateChange = function onStateChange ( ) {
@@ -218,7 +200,12 @@ export default function connectAdvanced(
218200 if ( ! this . selector . shouldComponentUpdate ) {
219201 subscription . notifyNestedSubs ( )
220202 } else {
221- this . setState ( dummyState , notifyNestedSubs )
203+ this . componentDidUpdate = function componentDidUpdate ( ) {
204+ this . componentDidUpdate = undefined
205+ subscription . notifyNestedSubs ( )
206+ }
207+
208+ this . setState ( dummyState )
222209 }
223210 } . bind ( this )
224211 }
@@ -275,9 +262,3 @@ export default function connectAdvanced(
275262 return hoistStatics ( Connect , WrappedComponent )
276263 }
277264}
278-
279- connectAdvanced . setDefaultReact15CompatibilityMode =
280- function setDefaultReact15CompatibilityMode ( compat ) {
281- defaultReact15CompatibilityMode = compat
282- }
283-
0 commit comments