-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Conversation
Doesn't this mean that fragments are not disabled? |
No there's an invariant for composites. Here's the test: https://github.com/acdlite/react/blob/ff6347a270605653c1859e58ad9b30cc557ee1a4/src/renderers/dom/fiber/__tests__/ReactDOMFiber-test.js#L1027 |
Also, what about the What exactly does this branch do? |
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. |
Updated. I moved the top-level invariant to the DOM renderer because the requirements vary too much. E.g. we need to allow |
const instance = returnFiber.stateNode; | ||
if (instance.render._isMockFunction) { | ||
// We allow auto-mocks to proceed as if they're | ||
// returning null. |
There was a problem hiding this comment.
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.)
There was a problem hiding this comment.
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 && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
@sebmarkbage @spicyj Ping |
// returning null. | ||
break; | ||
} | ||
switch (returnFiber.tag) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
This exposed a few more cases that I missed.
Treat them as if they return null
Easier to follow this way, and less chance the two paths will get out of sync.
When
disableNewFiberFeatures
was enabled, host component children arrays were treated as empty.