Recompose: should `isReferentiallyTransparentFunctionComponent` be completely off for non-production env?

Created on 24 Jul 2017  路  6Comments  路  Source: acdlite/recompose

Hi.

Right now

(process.env.NODE_ENV === 'production' || !Component.propTypes)

from here leads to lack of actual element while testing with Enzyme (NODE_ENV=test) so very dummy stateless components can't be found in a tree. Same problem with react-dev-tools (NODE_ENV=development), I can't see the component because function was directly invoked with props.

I understand the purpose of createEagerFactory, and the idea is really nice, but in my opinion it should be production only optimization. Should we consider removing || !Component.propTypes part from the condition or something like this? It's really confusing and took a lot of time to find the reason.

Most helpful comment

I remember about this, just took a few weeks break with any computer work. Now Im drinking vodka with bears in deep Russia and have mobile phone only ;-)

All 6 comments

The same confusion as here let us think a little,
seems like you are right
cc @wuct your thoughts?

The only problem I see is small perf degrade at dev mode.

Also it sounds like a breaking change because it might break many tests based on children count or (which is more likely) Jest snapshots.

The only problem I see is small perf degrade at dev mode.

One can't expect much performance from React in dev mode, all of these warnings, PropTypes, setter guards, and so on :) As for me it's totally fine.

Guys, sorry for pushing, but is there any conclusion? Plans for the next major version?

I remember about this, just took a few weeks break with any computer work. Now Im drinking vodka with bears in deep Russia and have mobile phone only ;-)

You can provide a PR with 90% probability we will accept it

Sorry for late reply and yes, a PR is welcome. This change probably can land at 0.25.

馃惢

Was this page helpful?
0 / 5 - 0 ratings

Related issues

istarkov picture istarkov  路  3Comments

cdomigan picture cdomigan  路  4Comments

xialvjun picture xialvjun  路  4Comments

joncursi picture joncursi  路  3Comments

rndmerle picture rndmerle  路  3Comments