MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / mountIndeterminateComponent

Function mountIndeterminateComponent

code/event-handlers/public/app.js:9416–9503  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

9414 }
9415
9416 function mountIndeterminateComponent(current, workInProgress, renderExpirationTime) {
9417 !(current === null) ? invariant(false, 'An indeterminate component should never have mounted. This error is likely caused by a bug in React. Please file an issue.') : void 0;
9418 var fn = workInProgress.type;
9419 var props = workInProgress.pendingProps;
9420 var unmaskedContext = getUnmaskedContext(workInProgress);
9421 var context = getMaskedContext(workInProgress, unmaskedContext);
9422
9423 var value = void 0;
9424
9425 {
9426 if (fn.prototype && typeof fn.prototype.render === 'function') {
9427 var componentName = getComponentName(workInProgress) || 'Unknown';
9428
9429 if (!didWarnAboutBadClass[componentName]) {
9430 warning(false, "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName);
9431 didWarnAboutBadClass[componentName] = true;
9432 }
9433 }
9434 ReactCurrentOwner.current = workInProgress;
9435 value = fn(props, context);
9436 }
9437 // React DevTools reads this flag.
9438 workInProgress.effectTag |= PerformedWork;
9439
9440 if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
9441 var Component = workInProgress.type;
9442
9443 // Proceed under the assumption that this is a class instance
9444 workInProgress.tag = ClassComponent;
9445
9446 workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null;
9447
9448 if (typeof Component.getDerivedStateFromProps === 'function') {
9449 var partialState = callGetDerivedStateFromProps(workInProgress, value, props, workInProgress.memoizedState);
9450
9451 if (partialState !== null && partialState !== undefined) {
9452 workInProgress.memoizedState = _assign({}, workInProgress.memoizedState, partialState);
9453 }
9454 }
9455
9456 // Push context providers early to prevent context stack mismatches.
9457 // During mounting we don't know the child context yet as the instance doesn't exist.
9458 // We will invalidate the child context in finishClassComponent() right after rendering.
9459 var hasContext = pushLegacyContextProvider(workInProgress);
9460 adoptClassInstance(workInProgress, value);
9461 mountClassInstance(workInProgress, renderExpirationTime);
9462 return finishClassComponent(current, workInProgress, true, hasContext, false, renderExpirationTime);
9463 } else {
9464 // Proceed under the assumption that this is a functional component
9465 workInProgress.tag = FunctionalComponent;
9466 {
9467 var _Component = workInProgress.type;
9468
9469 if (_Component) {
9470 warning(!_Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', _Component.displayName || _Component.name || 'Component');
9471 }
9472 if (workInProgress.ref !== null) {
9473 var info = '';

Callers 1

beginWorkFunction · 0.70

Calls 11

warningFunction · 0.85
invariantFunction · 0.70
getUnmaskedContextFunction · 0.70
getMaskedContextFunction · 0.70
getComponentNameFunction · 0.70
adoptClassInstanceFunction · 0.70
mountClassInstanceFunction · 0.70
finishClassComponentFunction · 0.70
reconcileChildrenFunction · 0.70
memoizePropsFunction · 0.70

Tested by

no test coverage detected