Skip to content

Conversation

@sebmarkbage
Copy link
Collaborator

The priority level gets reset at the wrong time because I rely
on mutating it at the wrong point. This moves it to the end of
completed work as a second pass over the children to see what
the highest priority is. This is inefficient for large sets but
we can try to find a smarter way to do this later. E.g. passing
it down the stack.

This bug fix revealed another bug that I had flagged before that
we're finding work to do in the "current" tree instead of the
working tree. For trees that were paused, e.g. childInProgress
trees, this won't work since don't have a current tree to search.

Therefore I fixed findNextUnitOfWorkAtPriority to use
workInProgress instead of current.

The priority level gets reset at the wrong time because I rely
on mutating it at the wrong point. This moves it to the end of
completed work as a second pass over the children to see what
the highest priority is. This is inefficient for large sets but
we can try to find a smarter way to do this later. E.g. passing
it down the stack.

This bug fix revealed another bug that I had flagged before that
we're finding work to do in the "current" tree instead of the
working tree. For trees that were paused, e.g. childInProgress
trees, this won't work since don't have a current tree to search.

Therefore I fixed findNextUnitOfWorkAtPriority to use
workInProgress instead of current.
// Don't bother drilling further down this tree if there is no child
// with more content.
// TODO: Shouldn't this still drill down even though the first
// shallow level doesn't have anything pending on it.
Copy link
Collaborator

@acdlite acdlite Aug 9, 2016

Choose a reason for hiding this comment

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

This todo is correct, I think. Once you split the priority fields to distinguish between the fiber's priority and the subtree's priority, there could be a matching update further down the tree. Now that this function operates on the work in progress tree, could you do a recursive call?

@acdlite acdlite mentioned this pull request Aug 9, 2016
alt.pendingProps = fiber.pendingProps;
alt.pendingWorkPriority = priorityLevel;

alt.memoizedProps = fiber.memoizedProps;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This turns out to be a bad idea, because it throws away progressed work all the time on the way up. This is what is causing the triangle demo to starve at slower speeds now. Needs a unit test to cover this case. However, not resetting this but resetting the child is also not correct and leads to incorrect results.

@sebmarkbage
Copy link
Collaborator Author

Going to abandon this strategy for now. Will try a different approach.

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.

3 participants