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

support Call and Return components in React.Children calls #11422

Merged
merged 6 commits into from Nov 20, 2017

Conversation

Projects
None yet
4 participants
@MatteoVH
Contributor

MatteoVH commented Nov 1, 2017

Solves #11416

@gaearon, I tried to read up a bit on Call and Return, but I'm (obviously seeing as it's an experimental API) inexperienced with them. Let me know if I'm testing their usage satisfactorily!

Show outdated Hide outdated packages/react/src/ReactChildren.js Outdated
Show outdated Hide outdated packages/react/src/__tests__/ReactChildren-test.js Outdated
@MatteoVH

This comment has been minimized.

Show comment
Hide comment
@MatteoVH

MatteoVH Nov 1, 2017

Contributor

Ready for re-review!

Contributor

MatteoVH commented Nov 1, 2017

Ready for re-review!

0xeac8;
const REACT_RETURN_TYPE =
(typeof Symbol === 'function' && Symbol.for && Symbol.for('react.return')) ||
0xeac9;
const REACT_PORTAL_TYPE =
(typeof Symbol === 'function' && Symbol.for && Symbol.for('react.portal')) ||

This comment has been minimized.

@nhunzaker

nhunzaker Nov 2, 2017

Collaborator

Does it make sense to share the typeof Symbol === 'function' && Symbol.for here? in a supportsSymbolFor variable, or something?

@nhunzaker

nhunzaker Nov 2, 2017

Collaborator

Does it make sense to share the typeof Symbol === 'function' && Symbol.for here? in a supportsSymbolFor variable, or something?

This comment has been minimized.

@gaearon

gaearon Nov 2, 2017

Member

Doesn't matter right now. This code executes once. Although it probably makes sense to copy how we do it in ReactChildFiber.

@gaearon

gaearon Nov 2, 2017

Member

Doesn't matter right now. This code executes once. Although it probably makes sense to copy how we do it in ReactChildFiber.

@gaearon

This comment has been minimized.

Show comment
Hide comment
@gaearon

gaearon Nov 6, 2017

Member

Friendly ping :-)

Member

gaearon commented Nov 6, 2017

Friendly ping :-)

@MatteoVH

This comment has been minimized.

Show comment
Hide comment
@MatteoVH

MatteoVH Nov 8, 2017

Contributor

Will have time tonight to re-factor!

Contributor

MatteoVH commented Nov 8, 2017

Will have time tonight to re-factor!

@MatteoVH

This comment has been minimized.

Show comment
Hide comment
@MatteoVH

MatteoVH Nov 10, 2017

Contributor

Sorry for the late response, I tried to move some of the if logic into a switch, and it just didn't seem to cleanly fit into that construct. I left one attempt, but I think it's more legible as it was before @gaearon.

Contributor

MatteoVH commented Nov 10, 2017

Sorry for the late response, I tried to move some of the if logic into a switch, and it just didn't seem to cleanly fit into that construct. I left one attempt, but I think it's more legible as it was before @gaearon.

Show outdated Hide outdated packages/react/src/ReactChildren.js Outdated
@gaearon

This comment has been minimized.

Show comment
Hide comment
@gaearon

gaearon Nov 20, 2017

Member

Instead of duplicating, can we just set a boolean flag? It starts out being false. Under conditions, we flip it to true. Then we check it at the bottom, and fire the callback if it is true.

Member

gaearon commented Nov 20, 2017

Instead of duplicating, can we just set a boolean flag? It starts out being false. Under conditions, we flip it to true. Then we check it at the bottom, and fire the callback if it is true.

@gaearon gaearon merged commit c6bde7b into facebook:master Nov 20, 2017

1 check passed

ci/circleci Your tests passed on CircleCI!
Details
@gaearon

This comment has been minimized.

Show comment
Hide comment
@gaearon

gaearon Nov 20, 2017

Member

Nice. Thanks.

Member

gaearon commented Nov 20, 2017

Nice. Thanks.

Ethan-Arrowood added a commit to Ethan-Arrowood/react that referenced this pull request Dec 8, 2017

support Call and Return components in React.Children calls (facebook#…
…11422)

* support Call and Return components in React.Children calls

* make tests more verbose

* fix ordering of React component types

* cleanup conditional detection of children type

* directly inline callback invocation

* reduce callback invocation code re-use
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment