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] Transfer everything from Element onto the Fiber and use Tag instead of Stage #6903

Merged
merged 2 commits into from
May 31, 2016

Conversation

sebmarkbage
Copy link
Collaborator

@sebmarkbage sebmarkbage commented May 27, 2016

This has a few benefits:

  1. This allows the element to always remain on the young generation.
  2. The key can be accessed on the fiber which is easier to keep as the
    same class and is directly accessible in the child reconciliation of every
    object.
  3. This conveniently means that we don't have to create a fake element for
    continuations which was really hacky.

We can still do the quick bailout of rerendered things using the props
object which is also unique.

Also I added a commit to use Tag instead of Stage for the coroutine
phase.

@gaearon
Copy link
Collaborator

gaearon commented May 27, 2016

Do I understand correctly that you want to stop holding onto the elements?

@sebmarkbage
Copy link
Collaborator Author

Yea. That part is a bit minor. A huge win would be to stop holding onto props which we can do too but that's a separate one. E.g. by always rerendering certain components or holding onto it in a WeakMap for ref equality check.

@sebmarkbage sebmarkbage changed the title [Fiber] Transfer everything from Element onto the Fiber [Fiber] Transfer everything from Element onto the Fiber and use Tag instead of Stage May 28, 2016
@ghost
Copy link

ghost commented May 28, 2016

@sebmarkbage updated the pull request.

@@ -97,9 +98,11 @@ function beginWork(unitOfWork : Fiber) : ?Fiber {
case HostComponent:
updateHostComponent(unitOfWork);
break;
case CoroutineHandlerPhase:
// This is a restart. Reset the tag to the initial phase.
unitOfWork.tag = CoroutineHandlerPhase;
Copy link
Collaborator

Choose a reason for hiding this comment

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

= CoroutineComponent

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 catch. This isn't covered by tests yet.

@sophiebits
Copy link
Collaborator

lgtm except the inline, as long as tests are the same.

This has a few benefits:

1) This allows the element to always remain on the young generation.
2) The key can be accessed on the fiber which is easier to keep as the
same class and is directly accessible in the child reconciliation of every
object.
3) This conveniently means that we don't have to create a fake element for
continuations which was really hacky.

We can still do the quick bailout of rerendered things using the props
object which is also unique.
This gets rid of a field that we only need for coroutines.

We might need this if we have multi phase handlers in the future
but then maybe we can just use multiple tags.
@ghost
Copy link

ghost commented May 31, 2016

@sebmarkbage updated the pull request.

@sebmarkbage sebmarkbage merged commit 7de2375 into facebook:master May 31, 2016
@zpao zpao added this to the 16.0 milestone Jun 1, 2016
@zpao zpao modified the milestones: 15-next, 16.0 Jun 6, 2016
zpao pushed a commit to zpao/react that referenced this pull request Jun 8, 2016
[Fiber] Transfer everything from Element onto the Fiber and use Tag instead of Stage
(cherry picked from commit 7de2375)
zpao pushed a commit that referenced this pull request Jun 14, 2016
[Fiber] Transfer everything from Element onto the Fiber and use Tag instead of Stage
(cherry picked from commit 7de2375)
@zpao zpao modified the milestones: 15-next, 15.2.0 Jun 14, 2016
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.

4 participants