-
Notifications
You must be signed in to change notification settings - Fork 1.3k
'withProps' on 'View' component crashes in release mode #525
Comments
Potential insight:
|
Any ideas about how we could check that its a class component ?https://github.com/acdlite/recompose/blob/master/src/packages/recompose/isClassComponent.js |
@istarkov I'd love to put some thoughts against. Can you give some background about how you're using |
Mostly for this optimization https://github.com/acdlite/recompose/blob/4b37008169c193e30014f49073173ce23b61af90/src/packages/recompose/isReferentiallyTransparentFunctionComponent.js Idea is that instead of creating new react elements on every HOC for some hocs we can replace element creation with direct function call on production env As an example compose(
mapProps(fnA),
mapProps(fnB)
)(Comp) in dev it wil generate something like const CompB = (props) => <Comp {...fnB(props)} />
const CompA = (props) => <CompB {...fnA(props)} /> But in release it will generate const CompB = (props) => <Comp {...fnB(props)} />
const CompA = (props) => CompB(fnA(props)) So for components with |
|
@developit may be you have any ideas about how to check that something is React/Preact class component without breaking compatibility with |
PS. I dont think that this optimisation somehow improves performance of real apps, may be in very rare usecases. Also there are babel plugins exists as I know with this optimization inside, in that case we can recommend to use babel plugin and remove it from code. |
oops we cant, this is runtime optimisation :-( |
#538 we removed Eager optimisations in 0.26 must work now |
This one is a doozy. I had a simple block component built by styling a standard
View
component. This was the basic idea:This worked fine in debug mode. In release mode,
withProps
caused a crash. Here is the trace from Xcode:Here is the same trace when running in debug mode, but with
NODE_ENV = production
.It also works if I use a different component (i.e.
Text
,ScrollView
). So this is probably a super-edge case, but still I found it in the wild. The fact that it only occurs in release mode made this one very hard to track down.I have a repo you can use to reproduce. If you open it in Xcode and hit Play, it will crash. But you can also just wrap a
View
inwithProps
anywhere and it seems to crash. I also noticed that wrapping aView
inonlyUpdateForPropTypes
also has this same issue.https://github.com/hellogerard/RecomposeBug
EDIT: Meant to add my packages:
"react": "16.0.0-alpha.12",
"react-native": "0.48.3",
"recompose": "^0.25.0"
The text was updated successfully, but these errors were encountered: