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

[Fiber] disableNewFiberFeatures bugfix: host component children arrays #8797

Merged
merged 6 commits into from
Jan 25, 2017

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Jan 15, 2017

When disableNewFiberFeatures was enabled, host component children arrays were treated as empty.

@sebmarkbage
Copy link
Collaborator

Doesn't this mean that fragments are not disabled?

@sebmarkbage
Copy link
Collaborator

Also, what about the <div>Text</div> case? This seems to disable single text children, no?

What exactly does this branch do?

@acdlite
Copy link
Collaborator Author

acdlite commented Jan 17, 2017

Haha you're right. Ok I'm definitely going to switch this flag to do be the default so we run all the tests against it.

@acdlite
Copy link
Collaborator Author

acdlite commented Jan 17, 2017

Updated. I moved the top-level invariant to the DOM renderer because the requirements vary too much. E.g. we need to allow null inside the reconciler because that's how we unmount. Also, React Art supports arrays at the root.

const instance = returnFiber.stateNode;
if (instance.render._isMockFunction) {
// We allow auto-mocks to proceed as if they're
// returning null.
Copy link
Collaborator

Choose a reason for hiding this comment

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

What you're really saying here is that they're allowed to return anything (including strings, arrays etc.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. Looks like Stack only accepts undefined. I'll add a test.

if (renderedElement === undefined &&

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated

@acdlite
Copy link
Collaborator Author

acdlite commented Jan 18, 2017

@sebmarkbage @spicyj Ping

// returning null.
break;
}
switch (returnFiber.tag) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems unnecessary to fork this whole function now. Can't you just add this conditional down below behind a smaller if (ReactFeatureFlags.disableNewFiberFeatures) { instead of forking the whole function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Forking the entire function was the only way I could get it down to a single check. But you're right that there's a lot of overlap and it's weird to fork the entire thing. I split it out into three checks instead.

Easier to follow this way, and less chance the two paths will get
out of sync.
@acdlite acdlite merged commit 63edf30 into facebook:master Jan 25, 2017
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