@@ -144,23 +144,6 @@ export default function createConnect(React) {
144
144
this . trySubscribe ( ) ;
145
145
}
146
146
147
- componentWillUpdate ( ) {
148
- if ( process . env . NODE_ENV !== 'production' ) {
149
- if ( this . version === version ) {
150
- return ;
151
- }
152
-
153
- // We are hot reloading!
154
- this . version = version ;
155
-
156
- // Update the state and bindings.
157
- this . trySubscribe ( ) ;
158
- this . recomputeStateProps ( ) ;
159
- this . recomputeDispatchProps ( ) ;
160
- this . recomputeState ( ) ;
161
- }
162
- }
163
-
164
147
componentWillReceiveProps ( nextProps ) {
165
148
if ( ! shallowEqual ( nextProps , this . props ) ) {
166
149
this . recomputeState ( nextProps ) ;
@@ -189,6 +172,32 @@ export default function createConnect(React) {
189
172
}
190
173
}
191
174
175
+ if ( (
176
+ // Node-like CommonJS environments (Browserify, Webpack)
177
+ typeof process !== 'undefined' &&
178
+ typeof process . env !== 'undefined' &&
179
+ process . env . NODE_ENV !== 'production'
180
+ ) ||
181
+ // React Native
182
+ typeof __DEV__ !== 'undefined' &&
183
+ __DEV__ //eslint-disable-line no-undef
184
+ ) {
185
+ Connect . prototype . componentWillUpdate = function componentWillUpdate ( ) {
186
+ if ( this . version === version ) {
187
+ return ;
188
+ }
189
+
190
+ // We are hot reloading!
191
+ this . version = version ;
192
+
193
+ // Update the state and bindings.
194
+ this . trySubscribe ( ) ;
195
+ this . recomputeStateProps ( ) ;
196
+ this . recomputeDispatchProps ( ) ;
197
+ this . recomputeState ( ) ;
198
+ } ;
199
+ }
200
+
192
201
return Connect ;
193
202
} ;
194
203
} ;
0 commit comments