-
Notifications
You must be signed in to change notification settings - Fork 47.4k
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
Conversation
Do I understand correctly that you want to stop holding onto the elements? |
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 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; |
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.
= CoroutineComponent
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 catch. This isn't covered by tests yet.
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.
6e09582
to
811084d
Compare
@sebmarkbage updated the pull request. |
[Fiber] Transfer everything from Element onto the Fiber and use Tag instead of Stage (cherry picked from commit 7de2375)
[Fiber] Transfer everything from Element onto the Fiber and use Tag instead of Stage (cherry picked from commit 7de2375)
This has a few benefits:
same class and is directly accessible in the child reconciliation of every
object.
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.