MCPcopy
hub / github.com/react/react / replayFunctionComponent

Function replayFunctionComponent

packages/react-reconciler/src/ReactFiberBeginWork.js:1534–1575  ·  view source on GitHub ↗
(
  current: Fiber | null,
  workInProgress: Fiber,
  nextProps: any,
  Component: any,
  secondArg: any,
  renderLanes: Lanes,
)

Source from the content-addressed store, hash-verified

1532}
1533
1534export function replayFunctionComponent(
1535 current: Fiber | null,
1536 workInProgress: Fiber,
1537 nextProps: any,
1538 Component: any,
1539 secondArg: any,
1540 renderLanes: Lanes,
1541): Fiber | null {
1542 // This function is used to replay a component that previously suspended,
1543 // after its data resolves. It's a simplified version of
1544 // updateFunctionComponent that reuses the hooks from the previous attempt.
1545
1546 prepareToReadContext(workInProgress, renderLanes);
1547 if (enableSchedulingProfiler) {
1548 markComponentRenderStarted(workInProgress);
1549 }
1550 const nextChildren = replaySuspendedComponentWithHooks(
1551 current,
1552 workInProgress,
1553 Component,
1554 nextProps,
1555 secondArg,
1556 );
1557 const hasId = checkDidRenderIdHook();
1558 if (enableSchedulingProfiler) {
1559 markComponentRenderStopped();
1560 }
1561
1562 if (current !== null && !didReceiveUpdate) {
1563 bailoutHooks(current, workInProgress, renderLanes);
1564 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
1565 }
1566
1567 if (getIsHydrating() && hasId) {
1568 pushMaterializedTreeId(workInProgress);
1569 }
1570
1571 // React DevTools reads this flag.
1572 workInProgress.flags |= PerformedWork;
1573 reconcileChildren(current, workInProgress, nextChildren, renderLanes);
1574 return workInProgress.child;
1575}
1576
1577function updateClassComponent(
1578 current: Fiber | null,

Callers 1

replayBeginWorkFunction · 0.90

Calls 8

prepareToReadContextFunction · 0.90
getIsHydratingFunction · 0.90
pushMaterializedTreeIdFunction · 0.90
checkDidRenderIdHookFunction · 0.85
reconcileChildrenFunction · 0.85

Tested by

no test coverage detected