Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update debugRenderPhaseSideEffects behavior #12057

Merged
merged 2 commits into from
Jan 24, 2018

Conversation

bvaughn
Copy link
Contributor

@bvaughn bvaughn commented Jan 19, 2018

Part one of #12046

This debugRenderPhaseSideEffects feature flag no longer double-invokes componentWillMount, componentWillReceiveProps, componentWillUpdate, or shouldComponentUpdate.

It continues to double-invoke the constructor, render, and setState updater functions as well as the recently added, static getDerivedStateFromProps method.

Tests have been updated.

I've verified that the new ctor statement in ReactFiberClassComponent is not dropped from the production build.

This feature flag no longer double-invokes componentWillMount, componentWillReceiveProps, componentWillUpdate, or shouldComponentUpdate.

It continues to double-invoke the constructor, render, and setState updater functions as well as the recently added, static getDerivedStateFromProps method

Tests have been updated.
@bvaughn
Copy link
Contributor Author

bvaughn commented Jan 23, 2018

Rebase~

Copy link
Contributor

@flarnie flarnie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does exactly what is described in #12046 ; makes sense to me, and thanks for updating the tests. I assume you did a grep to make sure you updated all relevant conditionals that use debugRenderPhaseSideEffects.

// Instantiate twice to help detect side-effects.
if (debugRenderPhaseSideEffects) {
new ctor(props, context); // eslint-disable-line no-new
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this should call the constructor twice, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It is called the second time right below:

const instance = new ctor(props, context);

@bvaughn bvaughn merged commit 431dca9 into facebook:master Jan 24, 2018
@bvaughn bvaughn deleted the 12046-part-1 branch January 24, 2018 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants