This file contains 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
function resetNextUnitOfWork() { | |
const update = updateQueue.shift(); | |
if (!update) { | |
return; | |
} | |
// Copy the setState parameter from the update payload to the corresponding fiber | |
if (update.partialState) { | |
update.instance.__fiber.partialState = update.partialState; | |
} | |
const root = | |
update.from == HOST_ROOT | |
? update.dom._rootContainerFiber | |
: getRoot(update.instance.__fiber); | |
nextUnitOfWork = { | |
tag: HOST_ROOT, | |
stateNode: update.dom || root.stateNode, | |
props: update.newProps || root.props, | |
alternate: root | |
}; | |
} | |
function getRoot(fiber) { | |
let node = fiber; | |
while (node.parent) { | |
node = node.parent; | |
} | |
return node; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment