Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Refactor of createElement props/config to fix bugs + use snapshotting #2070

Closed

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Jun 1, 2018

Release notes: fixes a range of spread bugs with ReactElements

This is a very important PR for React reconciliation, it fixes many undiscovered bugs and adds a huge amount of test coverage that was previously missing.

Whilst testing quite complex cases of JSX spreads in combination with defaultProps on our internal bundle I noticed that there were some bugs appearing, but because the branches where these bugs were appearing were not used on firstRender, it meant we got away with it on our internal tests.

We now use snapshotting and properly evaluateForEffects when recovering from Object.assign with ReactElement creation of config/props. We also properly use the temporalAlias to ensure we reference the correct object.

// i.e. <div {...something} /> --> React.createElement("div", something)
// if (abstractSpreadCount === 1 && astAttributes.length === 1) {
// return spreadValue;
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

Commented out by mistake?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, I was testing to make sure it worked with and without, but then forgot to enable it again :P

flagPropsWithNoPartialKeyOrRef(realm, config);
}
}
applyObjectAssignConfigsFoReactElement(realm, config, abstractPropsArgs);
Copy link
Contributor

Choose a reason for hiding this comment

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

typo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doh :D

}
}
}
// if defaultPropsEvauated === the amount of properties defaultProps has, then we've successfully
Copy link
Contributor

Choose a reason for hiding this comment

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

spelling of defaultPropsEvauated

Copy link
Contributor

@NTillmann NTillmann left a comment

Choose a reason for hiding this comment

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

I couldn't find anything obviously wrong.

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@trueadm is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@trueadm is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants