(current, workInProgress, renderLanes)
| 21524 | } |
| 21525 | |
| 21526 | function beginWork(current, workInProgress, renderLanes) { |
| 21527 | { |
| 21528 | if (workInProgress._debugNeedsRemount && current !== null) { |
| 21529 | // This will restart the begin phase with a new fiber. |
| 21530 | return remountFiber(current, workInProgress, createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.lanes)); |
| 21531 | } |
| 21532 | } |
| 21533 | |
| 21534 | if (current !== null) { |
| 21535 | var oldProps = current.memoizedProps; |
| 21536 | var newProps = workInProgress.pendingProps; |
| 21537 | |
| 21538 | if (oldProps !== newProps || hasContextChanged() || ( // Force a re-render if the implementation changed due to hot reload: |
| 21539 | workInProgress.type !== current.type )) { |
| 21540 | // If props or context changed, mark the fiber as having performed work. |
| 21541 | // This may be unset if the props are determined to be equal later (memo). |
| 21542 | didReceiveUpdate = true; |
| 21543 | } else { |
| 21544 | // Neither props nor legacy context changes. Check if there's a pending |
| 21545 | // update or context change. |
| 21546 | var hasScheduledUpdateOrContext = checkScheduledUpdateOrContext(current, renderLanes); |
| 21547 | |
| 21548 | if (!hasScheduledUpdateOrContext && // If this is the second pass of an error or suspense boundary, there |
| 21549 | // may not be work scheduled on `current`, so we check for this flag. |
| 21550 | (workInProgress.flags & DidCapture) === NoFlags) { |
| 21551 | // No pending updates or context. Bail out now. |
| 21552 | didReceiveUpdate = false; |
| 21553 | return attemptEarlyBailoutIfNoScheduledUpdate(current, workInProgress, renderLanes); |
| 21554 | } |
| 21555 | |
| 21556 | if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) { |
| 21557 | // This is a special case that only exists for legacy mode. |
| 21558 | // See https://github.com/facebook/react/pull/19216. |
| 21559 | didReceiveUpdate = true; |
| 21560 | } else { |
| 21561 | // An update was scheduled on this fiber, but there are no new props |
| 21562 | // nor legacy context. Set this to false. If an update queue or context |
| 21563 | // consumer produces a changed value, it will set this to true. Otherwise, |
| 21564 | // the component will assume the children have not changed and bail out. |
| 21565 | didReceiveUpdate = false; |
| 21566 | } |
| 21567 | } |
| 21568 | } else { |
| 21569 | didReceiveUpdate = false; |
| 21570 | |
| 21571 | if (getIsHydrating() && isForkedChild(workInProgress)) { |
| 21572 | // Check if this child belongs to a list of muliple children in |
| 21573 | // its parent. |
| 21574 | // |
| 21575 | // In a true multi-threaded implementation, we would render children on |
| 21576 | // parallel threads. This would represent the beginning of a new render |
| 21577 | // thread for this subtree. |
| 21578 | // |
| 21579 | // We only use this for id generation during hydration, which is why the |
| 21580 | // logic is located in this special branch. |
| 21581 | var slotIndex = workInProgress.index; |
| 21582 | var numberOfForks = getForksAtLevel(); |
| 21583 | pushTreeId(workInProgress, numberOfForks, slotIndex); |
no test coverage detected
searching dependent graphs…