MCPcopy Create free account
hub / github.com/reactjs/react-rails / updateForwardRef

Function updateForwardRef

lib/assets/react-source/development/react.js:20485–20532  ·  view source on GitHub ↗
(current, workInProgress, Component, nextProps, renderExpirationTime)

Source from the content-addressed store, hash-verified

20483 }
20484
20485 function updateForwardRef(current, workInProgress, Component, nextProps, renderExpirationTime) {
20486 // TODO: current can be non-null here even if the component
20487 // hasn't yet mounted. This happens after the first render suspends.
20488 // We'll need to figure out if this is fine or can cause issues.
20489 {
20490 if (workInProgress.type !== workInProgress.elementType) {
20491 // Lazy component props can't be validated in createElement
20492 // because they're only guaranteed to be resolved here.
20493 var innerPropTypes = Component.propTypes;
20494
20495 if (innerPropTypes) {
20496 checkPropTypes(innerPropTypes, nextProps, // Resolved props
20497 'prop', getComponentName(Component), getCurrentFiberStackInDev);
20498 }
20499 }
20500 }
20501
20502 var render = Component.render;
20503 var ref = workInProgress.ref; // The rest is a fork of updateFunctionComponent
20504
20505 var nextChildren;
20506 prepareToReadContext(workInProgress, renderExpirationTime);
20507
20508 {
20509 ReactCurrentOwner$1.current = workInProgress;
20510 setIsRendering(true);
20511 nextChildren = renderWithHooks(current, workInProgress, render, nextProps, ref, renderExpirationTime);
20512
20513 if ( workInProgress.mode & StrictMode) {
20514 // Only double-render components with Hooks
20515 if (workInProgress.memoizedState !== null) {
20516 nextChildren = renderWithHooks(current, workInProgress, render, nextProps, ref, renderExpirationTime);
20517 }
20518 }
20519
20520 setIsRendering(false);
20521 }
20522
20523 if (current !== null && !didReceiveUpdate) {
20524 bailoutHooks(current, workInProgress, renderExpirationTime);
20525 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
20526 } // React DevTools reads this flag.
20527
20528
20529 workInProgress.effectTag |= PerformedWork;
20530 reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
20531 return workInProgress.child;
20532 }
20533
20534 function updateMemoComponent(current, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
20535 if (current === null) {

Callers 2

mountLazyComponentFunction · 0.85
beginWorkFunction · 0.85

Calls 8

prepareToReadContextFunction · 0.85
setIsRenderingFunction · 0.85
renderWithHooksFunction · 0.85
bailoutHooksFunction · 0.85
reconcileChildrenFunction · 0.85
checkPropTypesFunction · 0.70
getComponentNameFunction · 0.70

Tested by

no test coverage detected