Skip to content

Commit f8ef550

Browse files
committed
fix: IE11 compact, #1099
1 parent d0648df commit f8ef550

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

Diff for: src/proxy/createClassProxy.js

+24-25
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const filteredPrototypeMethods = Proto =>
5050
return (
5151
descriptor &&
5252
prop.indexOf(PREFIX) !== 0 &&
53-
!blackListedClassMembers.includes(prop) &&
53+
blackListedClassMembers.indexOf(prop) < 0 &&
5454
typeof descriptor.value === 'function'
5555
)
5656
})
@@ -181,15 +181,6 @@ function createClassProxy(InitialComponent, proxyKey, options = {}) {
181181
instancesCount++
182182
},
183183
)
184-
// eslint-disable-next-line camelcase
185-
const UNSAFE_componentWillUpdate = lifeCycleWrapperFactory(
186-
'UNSAFE_componentWillUpdate',
187-
() => ({}),
188-
)
189-
const componentWillUpdate = lifeCycleWrapperFactory(
190-
'componentWillUpdate',
191-
() => ({}),
192-
)
193184
const componentDidUpdate = lifeCycleWrapperFactory(
194185
'componentDidUpdate',
195186
renderOptions.componentDidUpdate,
@@ -226,6 +217,11 @@ function createClassProxy(InitialComponent, proxyKey, options = {}) {
226217
return renderOptions.componentDidRender.call(this, result)
227218
}
228219

220+
function hotComponentUpdate() {
221+
renderOptions.componentWillRender(this)
222+
proxiedUpdate.call(this)
223+
}
224+
229225
function proxiedRender(...args) {
230226
renderOptions.componentWillRender(this)
231227
return hotComponentRender.call(this, ...args)
@@ -235,12 +231,9 @@ function createClassProxy(InitialComponent, proxyKey, options = {}) {
235231
defineClassMembers(Proxy, {
236232
...fakeBasePrototype(Base),
237233
// 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 }),
243235
hotComponentRender,
236+
hotComponentUpdate,
244237
componentDidMount,
245238
componentDidUpdate,
246239
componentWillUnmount,
@@ -259,6 +252,7 @@ function createClassProxy(InitialComponent, proxyKey, options = {}) {
259252

260253
ProxyFacade = ProxyComponent
261254
} else if (!proxyConfig.allowSFC) {
255+
proxyConfig.pureRender = false
262256
// SFC Converted to component. Does not support returning precreated instances from render.
263257
ProxyComponent = proxyClassCreator(Component, postConstructionAction)
264258

@@ -274,17 +268,9 @@ function createClassProxy(InitialComponent, proxyKey, options = {}) {
274268
ProxyFacade = function(props, context) {
275269
const result = CurrentComponent(props, context)
276270

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
286273
}
287-
setSFPFlag(ProxyFacade, false)
288274

289275
// This is a Relay-style container constructor. We can't do the prototype-
290276
// style wrapping for this as we do elsewhere, so just we just pass it
@@ -304,6 +290,19 @@ function createClassProxy(InitialComponent, proxyKey, options = {}) {
304290
return result
305291
}
306292

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+
307306
// Otherwise, it's a normal functional component. Build the real proxy
308307
// and use it going forward.
309308
ProxyComponent = proxyClassCreator(Component, postConstructionAction)

0 commit comments

Comments
 (0)