You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functioncommitWork(fiber){if(!fiber){return}letdomParentFiber=fiber.parentwhile(!domParentFiber.dom){domParentFiber=domParentFiber.parent}constdomParent=domParentFiber.domif(fiber.effectTag==="PLACEMENT"&&fiber.dom!=null){domParent.appendChild(fiber.dom)}elseif(fiber.effectTag==="UPDATE"&&fiber.dom!=null){updateDom(fiber.dom,fiber.alternate.props,fiber.props)}elseif(fiber.effectTag==="DELETION"){commitDeletion(fiber,domParent)// function should return at this momentreturn}commitWork(fiber.child)commitWork(fiber.sibling)}
let's call the fiber to be deleted oldFiber
if commitWork function didnt return after commitDeletion(oldFiber, domParent), it will commitWork(oldFiber.child) and commitWork(oldFiber.sibling).
This may cause a terrible bug, because u dont know what type is oldFiber.child.effectTag or oldFiber.sibiling.effectTag
and commitWork function dont know the two fibers are old fibers and will treat them as current fiber to process.
The text was updated successfully, but these errors were encountered:
1adybug
changed the title
function should return after commitDeletion(anOldFiber, domParent)
commitWork function should return after commitDeletion(anOldFiber, domParent)
Aug 25, 2022
let's call the fiber to be deleted
oldFiber
if
commitWork
function didnt return aftercommitDeletion(oldFiber, domParent)
, it willcommitWork(oldFiber.child)
andcommitWork(oldFiber.sibling)
.This may cause a terrible bug, because u dont know what type is
oldFiber.child.effectTag
oroldFiber.sibiling.effectTag
and
commitWork
function dont know the two fibers are old fibers and will treat them as current fiber to process.The text was updated successfully, but these errors were encountered: