[Fiber] Some setState related issues#8010
Merged
sebmarkbage merged 3 commits intofacebook:masterfrom Oct 19, 2016
Merged
Conversation
gaearon
reviewed
Oct 18, 2016
| // If there isn't any new props, then we'll reuse the memoized props. | ||
| // This could be from already completed work. | ||
| props = workInProgress.memoizedProps; | ||
| // props = current.memoizedProps; |
Collaborator
There was a problem hiding this comment.
Dead code or intentional comment?
Contributor
Author
There was a problem hiding this comment.
oops. left over.
We don't want to use the "current" props/state because if we have started work, then pause and continue then we'll have the newer props/state on it already. If it is not a resume, it should be the same as current.
Currently we flag the path to a setState as a higher priority than "offscreen". When we reconcile down this tree we bail out if it is a hidden node. However, in the case that node is already completed we don't hit that bail out path. We end up doing the work immediately which ends up committing that part of the tree at a higher priority. This ensures that we don't let a deprioritized subtree get reconciled at a higher priority.
6a862e7 to
cb2bc0d
Compare
acdlite
reviewed
Oct 19, 2016
| // Still not updated. | ||
| span(0), | ||
| span(0), | ||
| span(0) |
Collaborator
There was a problem hiding this comment.
How do know these spans haven't updated? idx hasn't changed, so even if you flush completely on line 654 you would still expect these to be 0. (On that point, what is the purpose of idx in this test?)
This proves that this number is actually deprioritized.
Collaborator
|
Looks good! Took me a while to figure out that second commit, though :D |
Contributor
Author
|
It took me almost a week to find a repro when I found the bug in the demo. :) |
acusti
pushed a commit
to brandcast/react
that referenced
this pull request
Mar 15, 2017
* Use the memoized props/state from the workInProgress We don't want to use the "current" props/state because if we have started work, then pause and continue then we'll have the newer props/state on it already. If it is not a resume, it should be the same as current. * Deprioritize setState within a deprioritized tree Currently we flag the path to a setState as a higher priority than "offscreen". When we reconcile down this tree we bail out if it is a hidden node. However, in the case that node is already completed we don't hit that bail out path. We end up doing the work immediately which ends up committing that part of the tree at a higher priority. This ensures that we don't let a deprioritized subtree get reconciled at a higher priority. * Bump idx in unit test This proves that this number is actually deprioritized.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use the memoized props/state from the workInProgress
We don't want to use the "current" props/state because if we have started work, then pause and continue then we'll have the newer props/state on it already. If it is not a resume, it should be the same as current.
Deprioritize setState within a deprioritized tree
Currently we flag the path to a setState as a higher priority than "offscreen". When we reconcile down this tree we bail out if it is a hidden node. However, in the case that node is already completed we don't hit that bail out path. We end up doing the work immediately which ends up committing that part of the tree at a higher priority.
This ensures that we don't let a deprioritized subtree get reconciled at a higher priority.