completeUnitOfWork: 得到要更新的 Fiber,形成链表

params

  1. unitOfWork

代码

if (returnFiber !== null && (returnFiber.flags & Incomplete) === NoFlags) {
  if (returnFiber.firstEffect === null) {
    returnFiber.firstEffect = completedWork.firstEffect;
  }

  if (completedWork.lastEffect !== null) {
    if (returnFiber.lastEffect !== null) {
      returnFiber.lastEffect.nextEffect = completedWork.firstEffect;
    }

    returnFiber.lastEffect = completedWork.lastEffect;
  }

  var flags = completedWork.flags;

  if (flags > PerformedWork) {
    if (returnFiber.lastEffect !== null) {
      returnFiber.lastEffect.nextEffect = completedWork;
    } else {
      returnFiber.firstEffect = completedWork;
    }

    returnFiber.lastEffect = completedWork;
  }
}

snowofcat
1 声望0 粉丝

没事早点睡,有空多赚钱,平时多读书