@@ -50,7 +50,7 @@ const filteredPrototypeMethods = Proto =>
50
50
return (
51
51
descriptor &&
52
52
prop . indexOf ( PREFIX ) !== 0 &&
53
- ! blackListedClassMembers . includes ( prop ) &&
53
+ blackListedClassMembers . indexOf ( prop ) < 0 &&
54
54
typeof descriptor . value === 'function'
55
55
)
56
56
} )
@@ -181,15 +181,6 @@ function createClassProxy(InitialComponent, proxyKey, options = {}) {
181
181
instancesCount ++
182
182
} ,
183
183
)
184
- // eslint-disable-next-line camelcase
185
- const UNSAFE_componentWillUpdate = lifeCycleWrapperFactory (
186
- 'UNSAFE_componentWillUpdate' ,
187
- ( ) => ( { } ) ,
188
- )
189
- const componentWillUpdate = lifeCycleWrapperFactory (
190
- 'componentWillUpdate' ,
191
- ( ) => ( { } ) ,
192
- )
193
184
const componentDidUpdate = lifeCycleWrapperFactory (
194
185
'componentDidUpdate' ,
195
186
renderOptions . componentDidUpdate ,
@@ -226,6 +217,11 @@ function createClassProxy(InitialComponent, proxyKey, options = {}) {
226
217
return renderOptions . componentDidRender . call ( this , result )
227
218
}
228
219
220
+ function hotComponentUpdate ( ) {
221
+ renderOptions . componentWillRender ( this )
222
+ proxiedUpdate . call ( this )
223
+ }
224
+
229
225
function proxiedRender ( ...args ) {
230
226
renderOptions . componentWillRender ( this )
231
227
return hotComponentRender . call ( this , ...args )
@@ -235,12 +231,9 @@ function createClassProxy(InitialComponent, proxyKey, options = {}) {
235
231
defineClassMembers ( Proxy , {
236
232
...fakeBasePrototype ( Base ) ,
237
233
// eslint-disable-next-line no-nested-ternary
238
- ...( proxyConfig . pureRender
239
- ? { render : proxiedRender }
240
- : Base . componentWillUpdate
241
- ? { componentWillUpdate }
242
- : { UNSAFE_componentWillUpdate } ) ,
234
+ ...( proxyConfig . pureRender ? { } : { render : proxiedRender } ) ,
243
235
hotComponentRender,
236
+ hotComponentUpdate,
244
237
componentDidMount,
245
238
componentDidUpdate,
246
239
componentWillUnmount,
@@ -259,6 +252,7 @@ function createClassProxy(InitialComponent, proxyKey, options = {}) {
259
252
260
253
ProxyFacade = ProxyComponent
261
254
} else if ( ! proxyConfig . allowSFC ) {
255
+ proxyConfig . pureRender = false
262
256
// SFC Converted to component. Does not support returning precreated instances from render.
263
257
ProxyComponent = proxyClassCreator ( Component , postConstructionAction )
264
258
@@ -274,17 +268,9 @@ function createClassProxy(InitialComponent, proxyKey, options = {}) {
274
268
ProxyFacade = function ( props , context ) {
275
269
const result = CurrentComponent ( props , context )
276
270
277
- // simple SFC, could continue to be SFC
278
- if ( proxyConfig . pureSFC ) {
279
- if ( ! CurrentComponent . contextTypes ) {
280
- if ( ! ProxyFacade . isStatelessFunctionalProxy ) {
281
- setSFPFlag ( ProxyFacade , true )
282
- }
283
-
284
- return renderOptions . componentDidRender ( result )
285
- }
271
+ if ( ! result ) {
272
+ return result
286
273
}
287
- setSFPFlag ( ProxyFacade , false )
288
274
289
275
// This is a Relay-style container constructor. We can't do the prototype-
290
276
// style wrapping for this as we do elsewhere, so just we just pass it
@@ -304,6 +290,19 @@ function createClassProxy(InitialComponent, proxyKey, options = {}) {
304
290
return result
305
291
}
306
292
293
+ // simple SFC, could continue to be SFC
294
+ if ( proxyConfig . pureSFC ) {
295
+ if ( ! CurrentComponent . contextTypes ) {
296
+ if ( ! ProxyFacade . isStatelessFunctionalProxy ) {
297
+ setSFPFlag ( ProxyFacade , true )
298
+ }
299
+
300
+ return renderOptions . componentDidRender ( result )
301
+ }
302
+ }
303
+ setSFPFlag ( ProxyFacade , false )
304
+ proxyConfig . pureRender = false
305
+
307
306
// Otherwise, it's a normal functional component. Build the real proxy
308
307
// and use it going forward.
309
308
ProxyComponent = proxyClassCreator ( Component , postConstructionAction )
0 commit comments