@@ -5,8 +5,6 @@ import { Component, PropTypes, createElement } from 'react'
5
5
import Subscription from '../utils/Subscription'
6
6
import storeShape from '../utils/storeShape'
7
7
8
-
9
- let defaultReact15CompatibilityMode = true
10
8
let hotReloadingVersion = 0
11
9
export default function connectAdvanced (
12
10
/*
@@ -37,9 +35,6 @@ export default function connectAdvanced(
37
35
// probably overridden by wrapper functions such as connect()
38
36
methodName = 'connectAdvanced' ,
39
37
40
- // temporary compatibility setting for React 15. See Connect constructor for details
41
- react15CompatibilityMode = undefined ,
42
-
43
38
// if defined, the name of the property passed to the wrapped element indicating the number of
44
39
// calls to render. useful for watching in react devtools for unnecessary re-renders.
45
40
renderCountProp = undefined ,
@@ -63,7 +58,6 @@ export default function connectAdvanced(
63
58
const contextTypes = {
64
59
[ storeKey ] : storeShape ,
65
60
[ subscriptionKey ] : PropTypes . instanceOf ( Subscription ) ,
66
- react15CompatibilityMode : PropTypes . bool ,
67
61
}
68
62
const childContextTypes = {
69
63
[ subscriptionKey ] : PropTypes . instanceOf ( Subscription )
@@ -103,18 +97,7 @@ export default function connectAdvanced(
103
97
this . state = { }
104
98
this . renderCount = 0
105
99
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 ]
118
101
119
102
this . setWrappedInstance = this . setWrappedInstance . bind ( this )
120
103
@@ -209,7 +192,6 @@ export default function connectAdvanced(
209
192
initSubscription ( ) {
210
193
if ( shouldHandleStateChanges ) {
211
194
const subscription = this . subscription = new Subscription ( this . store , this . parentSub )
212
- const notifyNestedSubs = subscription . notifyNestedSubs . bind ( subscription )
213
195
const dummyState = { }
214
196
215
197
subscription . onStateChange = function onStateChange ( ) {
@@ -218,7 +200,12 @@ export default function connectAdvanced(
218
200
if ( ! this . selector . shouldComponentUpdate ) {
219
201
subscription . notifyNestedSubs ( )
220
202
} else {
221
- this . setState ( dummyState , notifyNestedSubs )
203
+ this . componentDidUpdate = function componentDidUpdate ( ) {
204
+ this . componentDidUpdate = undefined
205
+ subscription . notifyNestedSubs ( )
206
+ }
207
+
208
+ this . setState ( dummyState )
222
209
}
223
210
} . bind ( this )
224
211
}
@@ -275,9 +262,3 @@ export default function connectAdvanced(
275
262
return hoistStatics ( Connect , WrappedComponent )
276
263
}
277
264
}
278
-
279
- connectAdvanced . setDefaultReact15CompatibilityMode =
280
- function setDefaultReact15CompatibilityMode ( compat ) {
281
- defaultReact15CompatibilityMode = compat
282
- }
283
-
0 commit comments