(current, workInProgress, renderLanes)
| 21563 | } |
| 21564 | |
| 21565 | function beginWork(current, workInProgress, renderLanes) { |
| 21566 | { |
| 21567 | if (workInProgress._debugNeedsRemount && current !== null) { |
| 21568 | // This will restart the begin phase with a new fiber. |
| 21569 | return remountFiber(current, workInProgress, createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.lanes)); |
| 21570 | } |
| 21571 | } |
| 21572 | |
| 21573 | if (current !== null) { |
| 21574 | var oldProps = current.memoizedProps; |
| 21575 | var newProps = workInProgress.pendingProps; |
| 21576 | |
| 21577 | if (oldProps !== newProps || hasContextChanged() || ( // Force a re-render if the implementation changed due to hot reload: |
| 21578 | workInProgress.type !== current.type )) { |
| 21579 | // If props or context changed, mark the fiber as having performed work. |
| 21580 | // This may be unset if the props are determined to be equal later (memo). |
| 21581 | didReceiveUpdate = true; |
| 21582 | } else { |
| 21583 | // Neither props nor legacy context changes. Check if there's a pending |
| 21584 | // update or context change. |
| 21585 | var hasScheduledUpdateOrContext = checkScheduledUpdateOrContext(current, renderLanes); |
| 21586 | |
| 21587 | if (!hasScheduledUpdateOrContext && // If this is the second pass of an error or suspense boundary, there |
| 21588 | // may not be work scheduled on `current`, so we check for this flag. |
| 21589 | (workInProgress.flags & DidCapture) === NoFlags) { |
| 21590 | // No pending updates or context. Bail out now. |
| 21591 | didReceiveUpdate = false; |
| 21592 | return attemptEarlyBailoutIfNoScheduledUpdate(current, workInProgress, renderLanes); |
| 21593 | } |
| 21594 | |
| 21595 | if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) { |
| 21596 | // This is a special case that only exists for legacy mode. |
| 21597 | // See https://github.com/facebook/react/pull/19216. |
| 21598 | didReceiveUpdate = true; |
| 21599 | } else { |
| 21600 | // An update was scheduled on this fiber, but there are no new props |
| 21601 | // nor legacy context. Set this to false. If an update queue or context |
| 21602 | // consumer produces a changed value, it will set this to true. Otherwise, |
| 21603 | // the component will assume the children have not changed and bail out. |
| 21604 | didReceiveUpdate = false; |
| 21605 | } |
| 21606 | } |
| 21607 | } else { |
| 21608 | didReceiveUpdate = false; |
| 21609 | |
| 21610 | if (getIsHydrating() && isForkedChild(workInProgress)) { |
| 21611 | // Check if this child belongs to a list of muliple children in |
| 21612 | // its parent. |
| 21613 | // |
| 21614 | // In a true multi-threaded implementation, we would render children on |
| 21615 | // parallel threads. This would represent the beginning of a new render |
| 21616 | // thread for this subtree. |
| 21617 | // |
| 21618 | // We only use this for id generation during hydration, which is why the |
| 21619 | // logic is located in this special branch. |
| 21620 | var slotIndex = workInProgress.index; |
| 21621 | var numberOfForks = getForksAtLevel(); |
| 21622 | pushTreeId(workInProgress, numberOfForks, slotIndex); |
no test coverage detected
searching dependent graphs…