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

Function mountIndeterminateComponent

code/styling/public/app.js:10086–10173  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

10084 }
10085
10086 function mountIndeterminateComponent(current, workInProgress, renderExpirationTime) {
10087 !(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;
10088 var fn = workInProgress.type;
10089 var props = workInProgress.pendingProps;
10090 var unmaskedContext = getUnmaskedContext(workInProgress);
10091 var context = getMaskedContext(workInProgress, unmaskedContext);
10092
10093 var value = void 0;
10094
10095 {
10096 if (fn.prototype && typeof fn.prototype.render === 'function') {
10097 var componentName = getComponentName(workInProgress) || 'Unknown';
10098
10099 if (!didWarnAboutBadClass[componentName]) {
10100 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);
10101 didWarnAboutBadClass[componentName] = true;
10102 }
10103 }
10104 ReactCurrentOwner.current = workInProgress;
10105 value = fn(props, context);
10106 }
10107 // React DevTools reads this flag.
10108 workInProgress.effectTag |= PerformedWork;
10109
10110 if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
10111 var Component = workInProgress.type;
10112
10113 // Proceed under the assumption that this is a class instance
10114 workInProgress.tag = ClassComponent;
10115
10116 workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null;
10117
10118 if (typeof Component.getDerivedStateFromProps === 'function') {
10119 var partialState = callGetDerivedStateFromProps(workInProgress, value, props, workInProgress.memoizedState);
10120
10121 if (partialState !== null && partialState !== undefined) {
10122 workInProgress.memoizedState = _assign({}, workInProgress.memoizedState, partialState);
10123 }
10124 }
10125
10126 // Push context providers early to prevent context stack mismatches.
10127 // During mounting we don't know the child context yet as the instance doesn't exist.
10128 // We will invalidate the child context in finishClassComponent() right after rendering.
10129 var hasContext = pushLegacyContextProvider(workInProgress);
10130 adoptClassInstance(workInProgress, value);
10131 mountClassInstance(workInProgress, renderExpirationTime);
10132 return finishClassComponent(current, workInProgress, true, hasContext, false, renderExpirationTime);
10133 } else {
10134 // Proceed under the assumption that this is a functional component
10135 workInProgress.tag = FunctionalComponent;
10136 {
10137 var _Component = workInProgress.type;
10138
10139 if (_Component) {
10140 warning(!_Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', _Component.displayName || _Component.name || 'Component');
10141 }
10142 if (workInProgress.ref !== null) {
10143 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